From 20434213f36978fc88cd871436e1f00b6305fb6e Mon Sep 17 00:00:00 2001 From: T0biasCZe Date: Mon, 5 Aug 2024 01:43:56 +0200 Subject: [PATCH] Fixed bug that prevented folders from loading when folder name contained space --- AdbFileManager/CurrentCommit.txt | 2 +- AdbFileManager/Form1.cs | 2 +- .../Properties/Resources.Designer.cs | 62 +------------------ AdbFileManager/Properties/Resources.resx | 18 ------ AdbFileManager/UnlockForm.Designer.cs | 14 +++-- AdbFileManager/UnlockForm.resx | 5 ++ AdbFileManager/legacyAndroid.cs | 4 +- 7 files changed, 18 insertions(+), 89 deletions(-) diff --git a/AdbFileManager/CurrentCommit.txt b/AdbFileManager/CurrentCommit.txt index 0d1f0f2..0d84d4b 100644 --- a/AdbFileManager/CurrentCommit.txt +++ b/AdbFileManager/CurrentCommit.txt @@ -1 +1 @@ -9cfa2c2 +f651e26 diff --git a/AdbFileManager/Form1.cs b/AdbFileManager/Form1.cs index 97c0b6d..3ca5511 100644 --- a/AdbFileManager/Form1.cs +++ b/AdbFileManager/Form1.cs @@ -688,7 +688,7 @@ public static DataTable getDir(string directoryPath, bool old_android, bool old_ // Retrieve a list of files in the specified directory - string command = $"adb shell ls -lL \"{directoryPath}\""; + string command = $"adb shell ls -lL \"'{directoryPath}'\""; Console.WriteLine(command); string output = Form1.adb(command); string[] lines = output.Split(new[] { Environment.NewLine }, StringSplitOptions.None); diff --git a/AdbFileManager/Properties/Resources.Designer.cs b/AdbFileManager/Properties/Resources.Designer.cs index defd940..f67c608 100644 --- a/AdbFileManager/Properties/Resources.Designer.cs +++ b/AdbFileManager/Properties/Resources.Designer.cs @@ -61,7 +61,7 @@ internal Resources() { } /// - /// Looks up a localized string similar to 9cfa2c2 + /// Looks up a localized string similar to f651e26 ///. /// public static string CurrentCommit { @@ -140,26 +140,6 @@ public static System.Drawing.Bitmap travel_pressed_forward { } } - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap unlock { - get { - object obj = ResourceManager.GetObject("unlock", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap unlock1 { - get { - object obj = ResourceManager.GetObject("unlock1", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -170,26 +150,6 @@ public static System.Drawing.Bitmap unlock16 { } } - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap unlock2 { - get { - object obj = ResourceManager.GetObject("unlock2", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap unlock24 { - get { - object obj = ResourceManager.GetObject("unlock24", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -199,25 +159,5 @@ public static System.Drawing.Bitmap unlockedShadow { return ((System.Drawing.Bitmap)(obj)); } } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap unlockk { - get { - object obj = ResourceManager.GetObject("unlockk", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap unlockkk { - get { - object obj = ResourceManager.GetObject("unlockkk", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } } } diff --git a/AdbFileManager/Properties/Resources.resx b/AdbFileManager/Properties/Resources.resx index 82d9ec3..9b627f1 100644 --- a/AdbFileManager/Properties/Resources.resx +++ b/AdbFileManager/Properties/Resources.resx @@ -121,9 +121,6 @@ ..\Resources\travel_pressed_back.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\unlock.ico;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\lockedShadow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -133,24 +130,12 @@ ..\Resources\travel_forward_enabled.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\unlockk.ico;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\unlock.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\unlockkk.ico;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\travel_hot_forward.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\CurrentCommit.txt;System.String, mscorlib, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;windows-1250 - - ..\Resources\unlock24.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\travel_back_enabled.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -160,9 +145,6 @@ ..\Resources\travel_hot_back.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\unlock1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\unlockedShadow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/AdbFileManager/UnlockForm.Designer.cs b/AdbFileManager/UnlockForm.Designer.cs index 2ac6934..9d77819 100644 --- a/AdbFileManager/UnlockForm.Designer.cs +++ b/AdbFileManager/UnlockForm.Designer.cs @@ -23,6 +23,7 @@ protected override void Dispose(bool disposing) { /// the contents of this method with the code editor. /// private void InitializeComponent() { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UnlockForm)); pictureBox1 = new PictureBox(); textBox1 = new TextBox(); richTextBox1 = new RichTextBox(); @@ -53,15 +54,16 @@ private void InitializeComponent() { // richTextBox1.BackColor = SystemColors.Control; richTextBox1.BorderStyle = BorderStyle.None; - richTextBox1.Location = new Point(216, 0); + richTextBox1.Font = new Font("Segoe UI", 8F, FontStyle.Regular, GraphicsUnit.Point, 238); + richTextBox1.Location = new Point(216, 8); richTextBox1.Name = "richTextBox1"; - richTextBox1.Size = new Size(128, 144); + richTextBox1.Size = new Size(176, 128); richTextBox1.TabIndex = 14; - richTextBox1.Text = "Sometimes when phone is locked, you cant copy files, which is problem when the display is broken.\nThis tool can try to unlock the phone, so you can backup your photos."; + richTextBox1.Text = resources.GetString("richTextBox1.Text"); // // keypad1 // - keypad1.Location = new Point(128, 32); + keypad1.Location = new Point(127, 32); keypad1.Name = "keypad1"; keypad1.Size = new Size(74, 97); keypad1.TabIndex = 15; @@ -74,7 +76,7 @@ private void InitializeComponent() { richTextBox2.BorderStyle = BorderStyle.None; richTextBox2.Location = new Point(8, 136); richTextBox2.Name = "richTextBox2"; - richTextBox2.Size = new Size(336, 40); + richTextBox2.Size = new Size(384, 40); richTextBox2.TabIndex = 16; richTextBox2.Text = ""; // @@ -82,7 +84,7 @@ private void InitializeComponent() { // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(354, 178); + ClientSize = new Size(393, 178); Controls.Add(richTextBox2); Controls.Add(keypad1); Controls.Add(richTextBox1); diff --git a/AdbFileManager/UnlockForm.resx b/AdbFileManager/UnlockForm.resx index af32865..1310b3d 100644 --- a/AdbFileManager/UnlockForm.resx +++ b/AdbFileManager/UnlockForm.resx @@ -117,4 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + After restart, the phone is locked and adb cant access files. However it may not be possible to unlock when the screen is broken. +This tool can try to unlock the phone, so you can backup your photos. +May not work on all phones + \ No newline at end of file diff --git a/AdbFileManager/legacyAndroid.cs b/AdbFileManager/legacyAndroid.cs index d50aefa..1d373e3 100644 --- a/AdbFileManager/legacyAndroid.cs +++ b/AdbFileManager/legacyAndroid.cs @@ -12,7 +12,7 @@ public static class legacyAndroid { public static bool fastcompatibility = false; public static DataTable getDir(string directoryPath) { // Retrieve a list of files in the specified directory without additional details - string command = $"adb shell ls \"{directoryPath}\""; + string command = $"adb shell ls \"'{directoryPath}'\""; Console.WriteLine(command); string output = Form1.adb(command); string[] lines = output.Split(new[] { Environment.NewLine }, StringSplitOptions.None); @@ -129,7 +129,7 @@ public static bool isFolder(string path, bool fastmode) { bool isFolder = false; //string wholePath = directoryPath + "/" + name; Console.Write($"checking if \"{path}\" is a folder: "); - string cdCommand = $"adb shell ls \"{path}\""; + string cdCommand = $"adb shell ls \"'{path}'\""; string cdOutput = Form1.adb(cdCommand); if(!cdOutput.Trim().Equals(path.Trim())) { isFolder = true;