@@ -51,7 +51,16 @@ public Form1() {
51
51
dataGridView1 . RowHeadersWidth = 4 ;
52
52
Console . WriteLine ( "datagrid virtual mode: " + dataGridView1 . VirtualMode ) ;
53
53
dataGridView1 . VirtualMode = false ;
54
- dataGridView1 . DataSource = Functions . getDir ( directoryPath , checkBox_android6fix . Checked ) ;
54
+ //dataGridView1.DataSource = Functions.getDir(directoryPath, checkBox_android6fix.Checked);
55
+ DataTable blank = new DataTable ( ) ;
56
+ //add header to blank
57
+ blank . Columns . Add ( "ico" , typeof ( Icon ) ) ;
58
+ blank . Columns . Add ( "Name" ) ;
59
+ blank . Columns . Add ( "Size" ) ;
60
+ blank . Columns . Add ( "Date" ) ;
61
+ blank . Columns . Add ( "Attr" ) ;
62
+ blank . Rows . Add ( new Icon ( @"icons\file.ico" ) , "Loading plz wait" , 0 , DateTime . UnixEpoch ) ;
63
+ dataGridView1 . DataSource = blank ;
55
64
56
65
DataGridViewImageColumn img = ( DataGridViewImageColumn ) dataGridView1 . Columns [ 0 ] ;
57
66
img . ImageLayout = DataGridViewImageCellLayout . Zoom ;
@@ -90,6 +99,7 @@ public static string adb(string command) {
90
99
while ( ! handle . IsCompleted ) {
91
100
Application . DoEvents ( ) ;
92
101
}
102
+ Application . DoEvents ( ) ;
93
103
94
104
Cursor . Current = Cursors . Default ;
95
105
return output ;
@@ -114,12 +124,13 @@ private void explorerBrowser1_Load(object sender, EventArgs e) {
114
124
}
115
125
116
126
private void dataGridView1_CellMouseDoubleClick ( object sender , DataGridViewCellMouseEventArgs e ) {
127
+ Console . WriteLine ( "CellMouseDoubleClick()" ) ;
117
128
if ( e . RowIndex >= 0 ) {
118
129
string name = dataGridView1 . Rows [ e . RowIndex ] . Cells [ 1 ] . Value . ToString ( ) ;
119
130
string size = dataGridView1 . Rows [ e . RowIndex ] . Cells [ 2 ] . Value . ToString ( ) ;
120
131
string date = dataGridView1 . Rows [ e . RowIndex ] . Cells [ 3 ] . Value . ToString ( ) ;
121
132
string permissions = dataGridView1 . Rows [ e . RowIndex ] . Cells [ 4 ] . Value . ToString ( ) ;
122
- if ( ! Functions . isFolder ( permissions ) ) {
133
+ if ( ! Functions . isFolder ( permissions , checkBox_android6fix . Checked ) ) {
123
134
if ( checkBox_preview . Checked ) {
124
135
if ( Functions . videoExtensions . Any ( x => name . EndsWith ( x , StringComparison . OrdinalIgnoreCase ) ) || Functions . imageExtensions . Any ( x => name . EndsWith ( x , StringComparison . OrdinalIgnoreCase ) ) || Functions . audioExtensions . Any ( x => name . EndsWith ( x , StringComparison . OrdinalIgnoreCase ) ) ) {
125
136
//copy file to temp folder
@@ -154,27 +165,14 @@ private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellM
154
165
}
155
166
else {
156
167
directoryPath = directoryPath + name + "/" ;
168
+ cur_path_modifyInternal = true ;
157
169
cur_path . Text = directoryPath ;
170
+ cur_path_modifyInternal = false ;
158
171
//MessageBox.Show(directoryPath);
159
172
dataGridView1 . DataSource = Functions . getDir ( directoryPath , checkBox_android6fix . Checked ) ;
160
173
}
161
174
}
162
175
}
163
- private int ParseProgress ( string line ) {
164
- // Assuming the progress is represented as a percentage in the output line
165
- // and it's always at the start of the line in the format of "[x%]"
166
- int startIndex = line . IndexOf ( '[' ) ;
167
- int endIndex = line . IndexOf ( ']' ) ;
168
- if ( startIndex != - 1 && endIndex != - 1 && endIndex > startIndex ) {
169
- string progressString = line . Substring ( startIndex + 1 , endIndex - startIndex - 1 ) . TrimEnd ( '%' ) ;
170
- if ( int . TryParse ( progressString , out int progress ) ) {
171
- return progress ;
172
- }
173
- }
174
-
175
- // Return -1 if the progress could not be parsed
176
- return - 1 ;
177
- }
178
176
bool copying = false ;
179
177
private void android2pc_Click ( object sender , EventArgs e ) {
180
178
string destinationFolder = ShellObject . FromParsingName ( explorerBrowser1 . NavigationLog . CurrentLocation . ParsingName ) . Properties . System . ItemPathDisplay . Value ;
@@ -188,7 +186,7 @@ private void android2pc_Click(object sender, EventArgs e) {
188
186
string size = row . Cells [ 2 ] . Value . ToString ( ) ;
189
187
string datee = row . Cells [ 3 ] . Value . ToString ( ) ;
190
188
string permissions = row . Cells [ 4 ] . Value . ToString ( ) ;
191
- bool isDirectory = Functions . isFolder ( permissions ) ;
189
+ bool isDirectory = Functions . isFolder ( permissions , checkBox_android6fix . Checked ) ;
192
190
files . Add ( new File ( name , size , datee , permissions , isDirectory ) ) ;
193
191
}
194
192
@@ -203,7 +201,7 @@ private void android2pc_Click(object sender, EventArgs e) {
203
201
for ( int i = 0 ; i < files . Count ; i ++ ) {
204
202
pgm . redraw ( ) ;
205
203
File file = files [ i ] ;
206
- if ( Functions . isFolder ( file ) ) {
204
+ if ( Functions . isFolder ( file , checkBox_android6fix . Checked ) ) {
207
205
Console . WriteLine ( "unwraping folder: " + file . name ) ;
208
206
DataTable newfiles_table = Functions . getDir ( directoryPath + file . name , checkBox_android6fix . Checked ) ;
209
207
Console . WriteLine ( "removed folder status: " + files . Remove ( file ) ) ;
@@ -214,7 +212,7 @@ private void android2pc_Click(object sender, EventArgs e) {
214
212
string size = row . ItemArray [ 2 ] . ToString ( ) ;
215
213
string datee = row . ItemArray [ 3 ] . ToString ( ) ;
216
214
string permissions = row . ItemArray [ 4 ] . ToString ( ) ;
217
- bool isDirectory = Functions . isFolder ( permissions ) ;
215
+ bool isDirectory = Functions . isFolder ( permissions , checkBox_android6fix . Checked ) ;
218
216
newfiles . Add ( new File ( file . name + "/" + name , size , datee , permissions , isDirectory ) ) ;
219
217
Console . WriteLine ( "added file: " + name ) ;
220
218
pgm . redraw ( ) ;
@@ -286,6 +284,7 @@ private void explorerBrowser1_PreviewKeyDown(object sender, PreviewKeyDownEventA
286
284
}
287
285
}
288
286
void clickedFolder ( ) {
287
+ Console . WriteLine ( "clickedFolder();" ) ;
289
288
int rowIndex = dataGridView1 . CurrentCell . RowIndex ;
290
289
if ( rowIndex >= 0 ) {
291
290
string name = dataGridView1 . Rows [ rowIndex ] . Cells [ 1 ] . Value . ToString ( ) ;
@@ -304,6 +303,7 @@ void clickedFolder() {
304
303
}
305
304
306
305
void goUpDirectory ( ) {
306
+ Console . WriteLine ( "goUpDirectory();" ) ;
307
307
if ( directoryPath . EndsWith ( "/" ) ) {
308
308
int length = directoryPath . Length - 1 ;
309
309
int lastIndex = directoryPath . Substring ( 0 , length - 1 ) . LastIndexOf ( "/" ) ;
@@ -319,15 +319,22 @@ void goUpDirectory() {
319
319
320
320
directoryPath = directoryPath . Substring ( 0 , lastIndex + 1 ) ;
321
321
}
322
+ cur_path_modifyInternal = true ;
322
323
cur_path . Text = directoryPath ;
324
+ cur_path_modifyInternal = false ;
323
325
dataGridView1 . DataSource = Functions . getDir ( directoryPath , checkBox_android6fix . Checked ) ;
324
326
}
325
327
private void timer1_Tick ( object sender , EventArgs e ) {
328
+ Console . WriteLine ( "timer ticked" ) ;
326
329
327
- dataGridView1 . DataSource = Functions . getDir ( directoryPath , checkBox_android6fix . Checked ) ;
328
- cur_path . Text = directoryPath ;
329
330
timer1 . Stop ( ) ;
330
331
timer1 . Enabled = false ;
332
+
333
+ dataGridView1 . DataSource = Functions . getDir ( directoryPath , checkBox_android6fix . Checked ) ;
334
+
335
+ cur_path_modifyInternal = true ;
336
+ cur_path . Text = directoryPath ;
337
+ cur_path_modifyInternal = false ;
331
338
}
332
339
333
340
private void pc2android_Click ( object sender , EventArgs e ) {
@@ -354,7 +361,13 @@ private void pc2android_Click(object sender, EventArgs e) {
354
361
copying = false ;
355
362
}
356
363
364
+ bool cur_path_modifyInternal = false ;
357
365
private void cur_path_TextChanged ( object sender , EventArgs e ) {
366
+ Console . WriteLine ( "cur_path_TextChanged();" ) ;
367
+ if ( cur_path_modifyInternal ) {
368
+ Console . WriteLine ( "cur_path_TextChanged false" ) ;
369
+ return ;
370
+ }
358
371
directoryPath = cur_path . Text ;
359
372
dataGridView1 . DataSource = Functions . getDir ( directoryPath , checkBox_android6fix . Checked ) ;
360
373
}
@@ -545,12 +558,14 @@ public static class Functions {
545
558
public static string [ ] archiveExtensions = { ".zip" , ".rar" , ".7z" , ".tar" , ".gz" , ".bz2" , ".xz" } ;
546
559
public static string [ ] executableExtensions = { ".exe" , ".dll" , ".bat" , ".msi" , ".jar" , ".py" , ".sh" , ".apk" } ;
547
560
548
- public static bool isFolder ( string path ) {
561
+ public static bool isFolder ( string path , bool old_android ) {
562
+ if ( old_android ) return legacyAndroid . isFolder ( path ) ;
549
563
if ( path == null ) return false ;
550
564
if ( path . ToLower ( ) . Trim ( ) [ 0 ] == 'd' ) return true ; //the first character of the line is 'd' if it's a directory
551
565
else return false ;
552
566
}
553
- public static bool isFolder ( File file ) {
567
+ public static bool isFolder ( File file , bool old_android ) {
568
+ if ( old_android ) return legacyAndroid . isFolder ( file ) ;
554
569
if ( file . permissions . ToLower ( ) . Trim ( ) [ 0 ] == 'd' ) return true ; //the first character of the line is 'd' if it's a directory
555
570
else return false ;
556
571
}
@@ -604,7 +619,7 @@ public static DataTable getDir(string directoryPath, bool old_android) {
604
619
string name = string . Join ( ' ' , attributes . Skip ( 7 ) ) ;
605
620
Icon icon ;
606
621
try {
607
- if ( isFolder ( permissions ) ) {
622
+ if ( isFolder ( permissions , old_android ) ) {
608
623
if ( file . Contains ( "dcim" , StringComparison . OrdinalIgnoreCase ) ) icon = Icons . folder_image ;
609
624
else if ( file . EndsWith ( @"download" , StringComparison . OrdinalIgnoreCase ) ) icon = Icons . folder_downloads ;
610
625
else if ( file . EndsWith ( @"music" , StringComparison . OrdinalIgnoreCase ) ) icon = Icons . folder_music ;
0 commit comments