@@ -51,7 +51,16 @@ public Form1() {
5151 dataGridView1 . RowHeadersWidth = 4 ;
5252 Console . WriteLine ( "datagrid virtual mode: " + dataGridView1 . VirtualMode ) ;
5353 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 ;
5564
5665 DataGridViewImageColumn img = ( DataGridViewImageColumn ) dataGridView1 . Columns [ 0 ] ;
5766 img . ImageLayout = DataGridViewImageCellLayout . Zoom ;
@@ -90,6 +99,7 @@ public static string adb(string command) {
9099 while ( ! handle . IsCompleted ) {
91100 Application . DoEvents ( ) ;
92101 }
102+ Application . DoEvents ( ) ;
93103
94104 Cursor . Current = Cursors . Default ;
95105 return output ;
@@ -114,12 +124,13 @@ private void explorerBrowser1_Load(object sender, EventArgs e) {
114124 }
115125
116126 private void dataGridView1_CellMouseDoubleClick ( object sender , DataGridViewCellMouseEventArgs e ) {
127+ Console . WriteLine ( "CellMouseDoubleClick()" ) ;
117128 if ( e . RowIndex >= 0 ) {
118129 string name = dataGridView1 . Rows [ e . RowIndex ] . Cells [ 1 ] . Value . ToString ( ) ;
119130 string size = dataGridView1 . Rows [ e . RowIndex ] . Cells [ 2 ] . Value . ToString ( ) ;
120131 string date = dataGridView1 . Rows [ e . RowIndex ] . Cells [ 3 ] . Value . ToString ( ) ;
121132 string permissions = dataGridView1 . Rows [ e . RowIndex ] . Cells [ 4 ] . Value . ToString ( ) ;
122- if ( ! Functions . isFolder ( permissions ) ) {
133+ if ( ! Functions . isFolder ( permissions , checkBox_android6fix . Checked ) ) {
123134 if ( checkBox_preview . Checked ) {
124135 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 ) ) ) {
125136 //copy file to temp folder
@@ -154,27 +165,14 @@ private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellM
154165 }
155166 else {
156167 directoryPath = directoryPath + name + "/" ;
168+ cur_path_modifyInternal = true ;
157169 cur_path . Text = directoryPath ;
170+ cur_path_modifyInternal = false ;
158171 //MessageBox.Show(directoryPath);
159172 dataGridView1 . DataSource = Functions . getDir ( directoryPath , checkBox_android6fix . Checked ) ;
160173 }
161174 }
162175 }
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- }
178176 bool copying = false ;
179177 private void android2pc_Click ( object sender , EventArgs e ) {
180178 string destinationFolder = ShellObject . FromParsingName ( explorerBrowser1 . NavigationLog . CurrentLocation . ParsingName ) . Properties . System . ItemPathDisplay . Value ;
@@ -188,7 +186,7 @@ private void android2pc_Click(object sender, EventArgs e) {
188186 string size = row . Cells [ 2 ] . Value . ToString ( ) ;
189187 string datee = row . Cells [ 3 ] . Value . ToString ( ) ;
190188 string permissions = row . Cells [ 4 ] . Value . ToString ( ) ;
191- bool isDirectory = Functions . isFolder ( permissions ) ;
189+ bool isDirectory = Functions . isFolder ( permissions , checkBox_android6fix . Checked ) ;
192190 files . Add ( new File ( name , size , datee , permissions , isDirectory ) ) ;
193191 }
194192
@@ -203,7 +201,7 @@ private void android2pc_Click(object sender, EventArgs e) {
203201 for ( int i = 0 ; i < files . Count ; i ++ ) {
204202 pgm . redraw ( ) ;
205203 File file = files [ i ] ;
206- if ( Functions . isFolder ( file ) ) {
204+ if ( Functions . isFolder ( file , checkBox_android6fix . Checked ) ) {
207205 Console . WriteLine ( "unwraping folder: " + file . name ) ;
208206 DataTable newfiles_table = Functions . getDir ( directoryPath + file . name , checkBox_android6fix . Checked ) ;
209207 Console . WriteLine ( "removed folder status: " + files . Remove ( file ) ) ;
@@ -214,7 +212,7 @@ private void android2pc_Click(object sender, EventArgs e) {
214212 string size = row . ItemArray [ 2 ] . ToString ( ) ;
215213 string datee = row . ItemArray [ 3 ] . ToString ( ) ;
216214 string permissions = row . ItemArray [ 4 ] . ToString ( ) ;
217- bool isDirectory = Functions . isFolder ( permissions ) ;
215+ bool isDirectory = Functions . isFolder ( permissions , checkBox_android6fix . Checked ) ;
218216 newfiles . Add ( new File ( file . name + "/" + name , size , datee , permissions , isDirectory ) ) ;
219217 Console . WriteLine ( "added file: " + name ) ;
220218 pgm . redraw ( ) ;
@@ -286,6 +284,7 @@ private void explorerBrowser1_PreviewKeyDown(object sender, PreviewKeyDownEventA
286284 }
287285 }
288286 void clickedFolder ( ) {
287+ Console . WriteLine ( "clickedFolder();" ) ;
289288 int rowIndex = dataGridView1 . CurrentCell . RowIndex ;
290289 if ( rowIndex >= 0 ) {
291290 string name = dataGridView1 . Rows [ rowIndex ] . Cells [ 1 ] . Value . ToString ( ) ;
@@ -304,6 +303,7 @@ void clickedFolder() {
304303 }
305304
306305 void goUpDirectory ( ) {
306+ Console . WriteLine ( "goUpDirectory();" ) ;
307307 if ( directoryPath . EndsWith ( "/" ) ) {
308308 int length = directoryPath . Length - 1 ;
309309 int lastIndex = directoryPath . Substring ( 0 , length - 1 ) . LastIndexOf ( "/" ) ;
@@ -319,15 +319,22 @@ void goUpDirectory() {
319319
320320 directoryPath = directoryPath . Substring ( 0 , lastIndex + 1 ) ;
321321 }
322+ cur_path_modifyInternal = true ;
322323 cur_path . Text = directoryPath ;
324+ cur_path_modifyInternal = false ;
323325 dataGridView1 . DataSource = Functions . getDir ( directoryPath , checkBox_android6fix . Checked ) ;
324326 }
325327 private void timer1_Tick ( object sender , EventArgs e ) {
328+ Console . WriteLine ( "timer ticked" ) ;
326329
327- dataGridView1 . DataSource = Functions . getDir ( directoryPath , checkBox_android6fix . Checked ) ;
328- cur_path . Text = directoryPath ;
329330 timer1 . Stop ( ) ;
330331 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 ;
331338 }
332339
333340 private void pc2android_Click ( object sender , EventArgs e ) {
@@ -354,7 +361,13 @@ private void pc2android_Click(object sender, EventArgs e) {
354361 copying = false ;
355362 }
356363
364+ bool cur_path_modifyInternal = false ;
357365 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+ }
358371 directoryPath = cur_path . Text ;
359372 dataGridView1 . DataSource = Functions . getDir ( directoryPath , checkBox_android6fix . Checked ) ;
360373 }
@@ -545,12 +558,14 @@ public static class Functions {
545558 public static string [ ] archiveExtensions = { ".zip" , ".rar" , ".7z" , ".tar" , ".gz" , ".bz2" , ".xz" } ;
546559 public static string [ ] executableExtensions = { ".exe" , ".dll" , ".bat" , ".msi" , ".jar" , ".py" , ".sh" , ".apk" } ;
547560
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 ) ;
549563 if ( path == null ) return false ;
550564 if ( path . ToLower ( ) . Trim ( ) [ 0 ] == 'd' ) return true ; //the first character of the line is 'd' if it's a directory
551565 else return false ;
552566 }
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 ) ;
554569 if ( file . permissions . ToLower ( ) . Trim ( ) [ 0 ] == 'd' ) return true ; //the first character of the line is 'd' if it's a directory
555570 else return false ;
556571 }
@@ -604,7 +619,7 @@ public static DataTable getDir(string directoryPath, bool old_android) {
604619 string name = string . Join ( ' ' , attributes . Skip ( 7 ) ) ;
605620 Icon icon ;
606621 try {
607- if ( isFolder ( permissions ) ) {
622+ if ( isFolder ( permissions , old_android ) ) {
608623 if ( file . Contains ( "dcim" , StringComparison . OrdinalIgnoreCase ) ) icon = Icons . folder_image ;
609624 else if ( file . EndsWith ( @"download" , StringComparison . OrdinalIgnoreCase ) ) icon = Icons . folder_downloads ;
610625 else if ( file . EndsWith ( @"music" , StringComparison . OrdinalIgnoreCase ) ) icon = Icons . folder_music ;
0 commit comments