diff --git a/FreeControl/Controller.cs b/FreeControl/Controller.cs index 2145fdc..e28834e 100644 --- a/FreeControl/Controller.cs +++ b/FreeControl/Controller.cs @@ -1,8 +1,8 @@ -using FreeControl.Utils; -using Sunny.UI; -using System; +using System; using System.Drawing; using System.Windows.Forms; +using FreeControl.Utils; +using Sunny.UI; namespace FreeControl { diff --git a/FreeControl/FreeControl.csproj b/FreeControl/FreeControl.csproj index b1bd206..8622b84 100644 --- a/FreeControl/FreeControl.csproj +++ b/FreeControl/FreeControl.csproj @@ -262,7 +262,6 @@ - Controller.cs @@ -283,7 +282,7 @@ - + diff --git a/FreeControl/FreeControl.sln b/FreeControl/FreeControl.sln new file mode 100644 index 0000000..c4cd196 --- /dev/null +++ b/FreeControl/FreeControl.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.002.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FreeControl", "FreeControl.csproj", "{A51E6D71-ECD5-4EFA-AEF5-DEB23B09F28C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A51E6D71-ECD5-4EFA-AEF5-DEB23B09F28C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A51E6D71-ECD5-4EFA-AEF5-DEB23B09F28C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A51E6D71-ECD5-4EFA-AEF5-DEB23B09F28C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A51E6D71-ECD5-4EFA-AEF5-DEB23B09F28C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B0513970-9479-420D-9EED-BD31B7489F5E} + EndGlobalSection +EndGlobal diff --git a/FreeControl/Main.cs b/FreeControl/Main.cs index d9b8a04..4e61af6 100644 --- a/FreeControl/Main.cs +++ b/FreeControl/Main.cs @@ -1,6 +1,4 @@ -using FreeControl.Utils; -using Sunny.UI; -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; @@ -8,10 +6,11 @@ using System.IO; using System.IO.Compression; using System.Linq; -using System.Reflection; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; +using FreeControl.Utils; +using Sunny.UI; namespace FreeControl { @@ -25,11 +24,11 @@ public partial class Main : UIForm /// /// scrcpy版本 /// - public static readonly string ScrcpyVersion = "scrcpy-win64-v2.4"; + public static readonly string ScrcpyVersion = "scrcpy-win32-v3.0"; /// /// scrcpy路径 /// - public static readonly string ScrcpyPath = Path.Combine(UserDataPath, ScrcpyVersion + "\\"); + public static string ScrcpyPath = Path.Combine(UserDataPath, ScrcpyVersion + "\\"); /// /// 用户桌面路径 /// @@ -68,19 +67,19 @@ public class Info /// /// 程序名称 不带空格 /// - public static readonly string Name = "FreeControl"; + public const string Name = "FreeControl"; /// /// 程序名称 带空格 /// - public static readonly string Name2 = "Free Control"; + public const string Name2 = "Free Control"; /// /// scrcpy标题 /// - public static readonly string ScrcpyTitle = "FreeControlScrcpy"; + public const string ScrcpyTitle = "FreeControlScrcpy"; /// /// 程序名称 带版本号 /// - public static string NameVersion { get; set; } + public static readonly string NameVersion = $"{Name} v{Program.Version}"; } /// @@ -186,22 +185,21 @@ public static void SetUserData(Setting userData) /// public void InitPdone() { - // 获取程序集信息 - Assembly asm = Assembly.GetExecutingAssembly(); - FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(asm.Location); + if (Directory.Exists(_Setting.CustomScrcpyPath)) + { + ScrcpyPath = _Setting.CustomScrcpyPath; + if (!ScrcpyPath.EndsWith("/") && !ScrcpyPath.EndsWith("\\")) + { + ScrcpyPath += "/"; + } + } // adb路径 ADB.ADBPath = $@"{ScrcpyPath}"; // 增加adb执行文件系统变量 ADB.AddEnvironmentPath(ScrcpyPath); - // 是否重新加载资源包 - bool reload = false; - if (_Setting.Version != fvi.ProductVersion) - { - reload = true; - _Setting.Version = fvi.ProductVersion; - } + _Setting.Version = Program.Version; // 提取资源 - ExtractResource(reload); + ExtractResource(); if (_Setting.MainWindowX != 0 || _Setting.MainWindowY != 0) { // 避免异常坐标导致窗口无法看到 同时需要考虑双屏时的负坐标 三屏或以上暂时无法测试与兼容 @@ -277,7 +275,6 @@ public void InitPdone() #endregion #region 设置标题和图标 - Info.NameVersion = $"FreeControl v{fvi.ProductVersion}"; Text = Info.NameVersion; ledTitle.Text = Info.NameVersion; ledTitle.CharCount = 19; @@ -335,18 +332,14 @@ public void InitPdone() /// /// 提取内置资源 /// - private void ExtractResource(bool reload = false) + private void ExtractResource() { string tempFileName = "temp.zip"; - // 如果重新加载 且旧目录存在 删除后重新解压资源 - if (reload && Directory.Exists(ScrcpyPath)) - { - Directory.Delete(ScrcpyPath, true); - } if (!Directory.Exists(ScrcpyPath)) { + _Setting.CustomScrcpyPath = ScrcpyPath; Directory.CreateDirectory(ScrcpyPath); - File.WriteAllBytes(ScrcpyPath + tempFileName, Properties.Resources.scrcpy_win64_v2_4); + File.WriteAllBytes(ScrcpyPath + tempFileName, Properties.Resources.scrcpy_win32_v3_0); // 解压缩 ZipFile.ExtractToDirectory(ScrcpyPath + tempFileName, UserDataPath); // 解压完成删除压缩包 diff --git a/FreeControl/Program.cs b/FreeControl/Program.cs index 2f9227c..fb4b83e 100644 --- a/FreeControl/Program.cs +++ b/FreeControl/Program.cs @@ -1,11 +1,31 @@ -using FreeControl.Utils; -using System; +using System; +using System.Reflection; +using System.Runtime.InteropServices; using System.Windows.Forms; +using FreeControl; +using FreeControl.Utils; + +[assembly: AssemblyTitle("在PC上控制Android设备")]//在PC上控制Android设备。 +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Pdone Technology Ltd.")] +[assembly: AssemblyProduct("Free Control")] +[assembly: AssemblyCopyright("Copyright © 2024 awaw.cc")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: ComVisible(false)] + +[assembly: Guid("ef7540e1-f2e7-4682-80ab-92354c55a4c6")] + +[assembly: AssemblyFileVersion(Program.Version)] +[assembly: AssemblyVersion(Program.Version)] namespace FreeControl { static class Program { + public const string Version = "1.7.3"; /// /// 应用程序的主入口点。 /// diff --git a/FreeControl/Properties/AssemblyInfo.cs b/FreeControl/Properties/AssemblyInfo.cs index e0094ac..5f28270 100644 --- a/FreeControl/Properties/AssemblyInfo.cs +++ b/FreeControl/Properties/AssemblyInfo.cs @@ -1,37 +1 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// 有关程序集的一般信息由以下 -// 控制。更改这些特性值可修改 -// 与程序集关联的信息。 -[assembly: AssemblyTitle("在PC上控制Android设备")]//在PC上控制Android设备。 -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Pdone Technology Ltd.")] -[assembly: AssemblyProduct("Free Control")] -[assembly: AssemblyCopyright("Copyright © 2024 awaw.cc")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 会使此程序集中的类型 -//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 -//请将此类型的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("ef7540e1-f2e7-4682-80ab-92354c55a4c6")] - -// 程序集的版本信息由下列四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 -//通过使用 "*",如下所示: -// [assembly: AssemblyVersion("1.0.*")] -//[assembly: AssemblyVersion("1.0.0")] -[assembly: AssemblyFileVersion("1.7.2")] -[assembly: AssemblyVersion("1.7.2")] + \ No newline at end of file diff --git a/FreeControl/Properties/Resources.Designer.cs b/FreeControl/Properties/Resources.Designer.cs index 68e844b..9fedba1 100644 --- a/FreeControl/Properties/Resources.Designer.cs +++ b/FreeControl/Properties/Resources.Designer.cs @@ -83,9 +83,9 @@ internal static System.Drawing.Icon pcm { /// /// 查找 System.Byte[] 类型的本地化资源。 /// - internal static byte[] scrcpy_win64_v2_4 { + internal static byte[] scrcpy_win32_v3_0 { get { - object obj = ResourceManager.GetObject("scrcpy_win64_v2_4", resourceCulture); + object obj = ResourceManager.GetObject("scrcpy_win32_v3_0", resourceCulture); return ((byte[])(obj)); } } diff --git a/FreeControl/Properties/Resources.resx b/FreeControl/Properties/Resources.resx index ca4c118..8ad6455 100644 --- a/FreeControl/Properties/Resources.resx +++ b/FreeControl/Properties/Resources.resx @@ -124,8 +124,8 @@ ..\Resources\pcm.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\scrcpy-win64-v2.4.zip;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\scrcpy-win32-v3.0.zip;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ..\Resources\shortcut_en.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/FreeControl/Resources/en.FreeControl.resources.dll b/FreeControl/Resources/en.FreeControl.resources.dll index c1897d0..ecd8902 100644 Binary files a/FreeControl/Resources/en.FreeControl.resources.dll and b/FreeControl/Resources/en.FreeControl.resources.dll differ diff --git a/FreeControl/Resources/scrcpy-win32-v3.0.zip b/FreeControl/Resources/scrcpy-win32-v3.0.zip new file mode 100644 index 0000000..bdf5f59 Binary files /dev/null and b/FreeControl/Resources/scrcpy-win32-v3.0.zip differ diff --git a/FreeControl/Resources/scrcpy-win64-v2.4.zip b/FreeControl/Resources/scrcpy-win64-v2.4.zip deleted file mode 100644 index 3b43689..0000000 Binary files a/FreeControl/Resources/scrcpy-win64-v2.4.zip and /dev/null differ diff --git a/FreeControl/Setting.cs b/FreeControl/Setting.cs index 1e0c3de..b00146b 100644 --- a/FreeControl/Setting.cs +++ b/FreeControl/Setting.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.ComponentModel; -using System.Linq; -using System.Text; namespace FreeControl { @@ -216,5 +213,10 @@ public List ControllerButton /// 自定义参数 /// public string CustomArgs { get; set; } = "--keyboard=uhid"; + + /// + /// 自定义Scrcpy路径 + /// + public string CustomScrcpyPath { get; set; } = ""; } } diff --git a/FreeControl/Trusteeship.cs b/FreeControl/Trusteeship.cs index ae76f57..a83ef01 100644 --- a/FreeControl/Trusteeship.cs +++ b/FreeControl/Trusteeship.cs @@ -1,5 +1,5 @@ -using FreeControl.Utils; -using System.Windows.Forms; +using System.Windows.Forms; +using FreeControl.Utils; namespace FreeControl { diff --git a/FreeControl/Update.en.md b/FreeControl/Update.en.md index a74e92a..383bdaa 100644 --- a/FreeControl/Update.en.md +++ b/FreeControl/Update.en.md @@ -1,5 +1,9 @@ # Free Control Update Record +## v1.7.3 +- Based on scrcpy v3.0(x32) +- Add 'CustomScrcpyPath' parameter to customize Scrcpy directory + ## v1.7.2 - Fix bug diff --git a/FreeControl/Update.md b/FreeControl/Update.md index d34a018..a4fd7eb 100644 --- a/FreeControl/Update.md +++ b/FreeControl/Update.md @@ -1,5 +1,9 @@ # Free Control 更新记录 +## v1.7.3 +- 基于scrcpy v3.0(x32) +- 增加 `CustomScrcpyPath` 参数用于自定义Scrcpy目录 + ## v1.7.2 - 修复了一些bug diff --git a/FreeControl/Utils/ADB.cs b/FreeControl/Utils/ADB.cs index a383545..c52d920 100644 --- a/FreeControl/Utils/ADB.cs +++ b/FreeControl/Utils/ADB.cs @@ -1,11 +1,7 @@ using System; -using System.Collections.Generic; using System.Diagnostics; using System.IO; -using System.Linq; using System.Text; -using System.Threading; -using System.Threading.Tasks; namespace FreeControl.Utils { diff --git a/FreeControl/Utils/Extend.cs b/FreeControl/Utils/Extend.cs index bbbac54..488537b 100644 --- a/FreeControl/Utils/Extend.cs +++ b/FreeControl/Utils/Extend.cs @@ -4,7 +4,6 @@ using System.Linq; using System.Reflection; using System.Runtime.InteropServices; -using System.Windows.Forms.VisualStyles; namespace FreeControl.Utils { diff --git a/FreeControl/Utils/FileHelper.cs b/FreeControl/Utils/FileHelper.cs index e11b244..35a16a9 100644 --- a/FreeControl/Utils/FileHelper.cs +++ b/FreeControl/Utils/FileHelper.cs @@ -1,9 +1,5 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; +using System.IO; using System.Reflection; -using System.Text; namespace FreeControl.Utils { diff --git a/FreeControl/Utils/MoveListener.cs b/FreeControl/Utils/MoveListener.cs index 3add81d..66bd957 100644 --- a/FreeControl/Utils/MoveListener.cs +++ b/FreeControl/Utils/MoveListener.cs @@ -2,7 +2,6 @@ using System.Diagnostics; using System.Runtime.InteropServices; using System.Text; -using System.Threading.Tasks; using System.Timers; namespace FreeControl.Utils diff --git a/FreeControl/Utils/SysEnvironment.cs b/FreeControl/Utils/SysEnvironment.cs index b136dec..850b59a 100644 --- a/FreeControl/Utils/SysEnvironment.cs +++ b/FreeControl/Utils/SysEnvironment.cs @@ -1,9 +1,5 @@ -using Microsoft.Win32; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; +using System; +using Microsoft.Win32; namespace FreeControl.Utils { diff --git a/FreeControl/Utils/ZIPHelper.cs b/FreeControl/Utils/ZIPHelper.cs deleted file mode 100644 index 1ad88c7..0000000 --- a/FreeControl/Utils/ZIPHelper.cs +++ /dev/null @@ -1,398 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.IO; -using System.Diagnostics; -using Microsoft.Win32; - -//using ICSharpCode.SharpZipLib.Checksums; -//using ICSharpCode.SharpZipLib.Zip; - -///压缩、解压缩类 -namespace FreeControl.Utils -{ - //public class SharpZip - //{ - // public SharpZip() - // { } - - // /// - // /// 压缩 - // /// - // /// 压缩后的文件名(包含物理路径) - // /// 待压缩的文件夹(包含物理路径) - // public static void PackFiles(string filename, string directory) - // { - // try - // { - // FastZip fz = new FastZip(); - // fz.CreateEmptyDirectories = true; - // fz.CreateZip(filename, directory, true, ""); - // fz = null; - // } - // catch (Exception) - // { - // throw; - // } - // } - - // /// - // /// 解压缩 - // /// - // /// 待解压文件名(包含物理路径) - // /// 解压到哪个目录中(包含物理路径) - // public static bool UnpackFiles(string file, string dir) - // { - // try - // { - // if (!Directory.Exists(dir)) - // { - // Directory.CreateDirectory(dir); - // } - // ZipInputStream s = new ZipInputStream(File.OpenRead(file)); - // ZipEntry theEntry; - // while ((theEntry = s.GetNextEntry()) != null) - // { - // string directoryName = Path.GetDirectoryName(theEntry.Name); - // string fileName = Path.GetFileName(theEntry.Name); - // if (directoryName != String.Empty) - // { - // Directory.CreateDirectory(dir + directoryName); - // } - // if (fileName != String.Empty) - // { - // FileStream streamWriter = File.Create(dir + theEntry.Name); - // int size = 2048; - // byte[] data = new byte[2048]; - // while (true) - // { - // size = s.Read(data, 0, data.Length); - // if (size > 0) - // { - // streamWriter.Write(data, 0, size); - // } - // else - // { - // break; - // } - // } - // streamWriter.Close(); - // } - // } - // s.Close(); - // return true; - // } - // catch (Exception) - // { - // throw; - // } - // } - //} - - //public class ClassZip - //{ - // #region 私有方法 - // /// - // /// 递归压缩文件夹方法 - // /// - // private static bool ZipFileDictory(string FolderToZip, ZipOutputStream s, string ParentFolderName) - // { - // bool res = true; - // string[] folders, filenames; - // ZipEntry entry = null; - // FileStream fs = null; - // Crc32 crc = new Crc32(); - // try - // { - // entry = new ZipEntry(Path.Combine(ParentFolderName, Path.GetFileName(FolderToZip) + "/")); - // s.PutNextEntry(entry); - // s.Flush(); - // filenames = Directory.GetFiles(FolderToZip); - // foreach (string file in filenames) - // { - // fs = File.OpenRead(file); - // byte[] buffer = new byte[fs.Length]; - // fs.Read(buffer, 0, buffer.Length); - // entry = new ZipEntry(Path.Combine(ParentFolderName, Path.GetFileName(FolderToZip) + "/" + Path.GetFileName(file))); - // entry.DateTime = DateTime.Now; - // entry.Size = fs.Length; - // fs.Close(); - // crc.Reset(); - // crc.Update(buffer); - // entry.Crc = crc.Value; - // s.PutNextEntry(entry); - // s.Write(buffer, 0, buffer.Length); - // } - // } - // catch - // { - // res = false; - // } - // finally - // { - // if (fs != null) - // { - // fs.Close(); - // fs = null; - // } - // if (entry != null) - // { - // entry = null; - // } - // GC.Collect(); - // GC.Collect(1); - // } - // folders = Directory.GetDirectories(FolderToZip); - // foreach (string folder in folders) - // { - // if (!ZipFileDictory(folder, s, Path.Combine(ParentFolderName, Path.GetFileName(FolderToZip)))) - // { - // return false; - // } - // } - // return res; - // } - - // /// - // /// 压缩目录 - // /// - // /// 待压缩的文件夹,全路径格式 - // /// 压缩后的文件名,全路径格式 - // private static bool ZipFileDictory(string FolderToZip, string ZipedFile, int level) - // { - // bool res; - // if (!Directory.Exists(FolderToZip)) - // { - // return false; - // } - // ZipOutputStream s = new ZipOutputStream(File.Create(ZipedFile)); - // s.SetLevel(level); - // res = ZipFileDictory(FolderToZip, s, ""); - // s.Finish(); - // s.Close(); - // return res; - // } - - // /// - // /// 压缩文件 - // /// - // /// 要进行压缩的文件名 - // /// 压缩后生成的压缩文件名 - // private static bool ZipFile(string FileToZip, string ZipedFile, int level) - // { - // if (!File.Exists(FileToZip)) - // { - // throw new System.IO.FileNotFoundException("指定要压缩的文件: " + FileToZip + " 不存在!"); - // } - // FileStream ZipFile = null; - // ZipOutputStream ZipStream = null; - // ZipEntry ZipEntry = null; - // bool res = true; - // try - // { - // ZipFile = File.OpenRead(FileToZip); - // byte[] buffer = new byte[ZipFile.Length]; - // ZipFile.Read(buffer, 0, buffer.Length); - // ZipFile.Close(); - - // ZipFile = File.Create(ZipedFile); - // ZipStream = new ZipOutputStream(ZipFile); - // ZipEntry = new ZipEntry(Path.GetFileName(FileToZip)); - // ZipStream.PutNextEntry(ZipEntry); - // ZipStream.SetLevel(level); - - // ZipStream.Write(buffer, 0, buffer.Length); - // } - // catch - // { - // res = false; - // } - // finally - // { - // if (ZipEntry != null) - // { - // ZipEntry = null; - // } - // if (ZipStream != null) - // { - // ZipStream.Finish(); - // ZipStream.Close(); - // } - // if (ZipFile != null) - // { - // ZipFile.Close(); - // ZipFile = null; - // } - // GC.Collect(); - // GC.Collect(1); - // } - // return res; - // } - // #endregion - - // /// - // /// 压缩 - // /// - // /// 待压缩的文件目录 - // /// 生成的目标文件 - // /// 6 - // public static bool Zip(String FileToZip, String ZipedFile, int level) - // { - // if (Directory.Exists(FileToZip)) - // { - // return ZipFileDictory(FileToZip, ZipedFile, level); - // } - // else if (File.Exists(FileToZip)) - // { - // return ZipFile(FileToZip, ZipedFile, level); - // } - // else - // { - // return false; - // } - // } - - // /// - // /// 解压 - // /// - // /// 待解压的文件 - // /// 解压目标存放目录 - // public static void UnZip(string FileToUpZip, string ZipedFolder) - // { - // if (!File.Exists(FileToUpZip)) - // { - // return; - // } - // if (!Directory.Exists(ZipedFolder)) - // { - // Directory.CreateDirectory(ZipedFolder); - // } - // ZipInputStream s = null; - // ZipEntry theEntry = null; - // string fileName; - // FileStream streamWriter = null; - // try - // { - // s = new ZipInputStream(File.OpenRead(FileToUpZip)); - // while ((theEntry = s.GetNextEntry()) != null) - // { - // if (theEntry.Name != String.Empty) - // { - // fileName = Path.Combine(ZipedFolder, theEntry.Name); - // if (fileName.EndsWith("/") || fileName.EndsWith("\\")) - // { - // Directory.CreateDirectory(fileName); - // continue; - // } - // streamWriter = File.Create(fileName); - // int size = 2048; - // byte[] data = new byte[2048]; - // while (true) - // { - // size = s.Read(data, 0, data.Length); - // if (size > 0) - // { - // streamWriter.Write(data, 0, size); - // } - // else - // { - // break; - // } - // } - // } - // } - // } - // finally - // { - // if (streamWriter != null) - // { - // streamWriter.Close(); - // streamWriter = null; - // } - // if (theEntry != null) - // { - // theEntry = null; - // } - // if (s != null) - // { - // s.Close(); - // s = null; - // } - // GC.Collect(); - // GC.Collect(1); - // } - // } - //} - - //public class ZipHelper - //{ - // #region 私有变量 - // String the_rar; - // RegistryKey the_Reg; - // Object the_Obj; - // String the_Info; - // ProcessStartInfo the_StartInfo; - // Process the_Process; - // #endregion - - // /// - // /// 压缩 - // /// - // /// 要解压的文件名 - // /// 要压缩的文件目录 - // /// 初始目录 - // public void EnZip(string zipname, string zippath, string dirpath) - // { - // try - // { - // the_Reg = Registry.ClassesRoot.OpenSubKey(@"Applications\WinRAR.exe\Shell\Open\Command"); - // the_Obj = the_Reg.GetValue(""); - // the_rar = the_Obj.ToString(); - // the_Reg.Close(); - // the_rar = the_rar.Substring(1, the_rar.Length - 7); - // the_Info = " a " + zipname + " " + zippath; - // the_StartInfo = new ProcessStartInfo(); - // the_StartInfo.FileName = the_rar; - // the_StartInfo.Arguments = the_Info; - // the_StartInfo.WindowStyle = ProcessWindowStyle.Hidden; - // the_StartInfo.WorkingDirectory = dirpath; - // the_Process = new Process(); - // the_Process.StartInfo = the_StartInfo; - // the_Process.Start(); - // } - // catch (Exception ex) - // { - // throw new Exception(ex.Message); - // } - // } - - // /// - // /// 解压缩 - // /// - // /// 要解压的文件名 - // /// 要解压的文件路径 - // public void DeZip(string zipname, string zippath) - // { - // try - // { - // the_Reg = Registry.ClassesRoot.OpenSubKey(@"Applications\WinRar.exe\Shell\Open\Command"); - // the_Obj = the_Reg.GetValue(""); - // the_rar = the_Obj.ToString(); - // the_Reg.Close(); - // the_rar = the_rar.Substring(1, the_rar.Length - 7); - // the_Info = " X " + zipname + " " + zippath; - // the_StartInfo = new ProcessStartInfo(); - // the_StartInfo.FileName = the_rar; - // the_StartInfo.Arguments = the_Info; - // the_StartInfo.WindowStyle = ProcessWindowStyle.Hidden; - // the_Process = new Process(); - // the_Process.StartInfo = the_StartInfo; - // the_Process.Start(); - // } - // catch (Exception ex) - // { - // throw new Exception(ex.Message); - // } - // } - //} -} \ No newline at end of file diff --git a/README.md b/README.md index c7bedb3..60b83ca 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,21 @@ https://cdn.awaw.cc/gh/pdone/FreeControl/releases/latest/download/FreeControl.ex ## 常见问题 +### 自定义Scrcpy路径 + +`v1.7.3` 增加了 `CustomScrcpyPath` 参数,默认值为程序内置Scrcpy目录。 +可以在配置文件 `%AppData%\FreeControl\config.json` 中,将值改为你自己的Scrcpy目录。 +需要注意,路径中反斜杠须进行转义,改为双反斜杠;也可以使用斜杠。 + +```json +// 使用反斜杠示例 +"CustomScrcpyPath":"D:\\YourDir\\scrcpy-win64-v3.0\\" +``` +```json +// 使用斜杠示例 +"CustomScrcpyPath":"D:/Test/scrcpy-win64-v3.0/" +``` + ### 关闭窗口后锁屏 `v1.7.1` 及以后的版本中,增加 `PowerOffOnClose` 参数,用于控制关闭控制窗口后,是否将手机锁屏。默认不启用,可以在配置文件 `%AppData%\FreeControl\config.json` 中,将 `PowerOffOnClose` 参数值改为 `true` 以启用。