1- using FreeControl . Utils ;
2- using Sunny . UI ;
3- using System ;
1+ using System ;
42using System . Collections . Generic ;
53using System . ComponentModel ;
64using System . Diagnostics ;
75using System . Drawing ;
86using System . IO ;
97using System . IO . Compression ;
108using System . Linq ;
11- using System . Reflection ;
129using System . Threading ;
1310using System . Threading . Tasks ;
1411using System . Windows . Forms ;
12+ using FreeControl . Utils ;
13+ using Sunny . UI ;
1514
1615namespace FreeControl
1716{
@@ -25,11 +24,11 @@ public partial class Main : UIForm
2524 /// <summary>
2625 /// scrcpy版本
2726 /// </summary>
28- public static readonly string ScrcpyVersion = "scrcpy-win64-v2.4 " ;
27+ public static readonly string ScrcpyVersion = "scrcpy-win32-v3.0 " ;
2928 /// <summary>
3029 /// scrcpy路径
3130 /// </summary>
32- public static readonly string ScrcpyPath = Path . Combine ( UserDataPath , ScrcpyVersion + "\\ " ) ;
31+ public static string ScrcpyPath = Path . Combine ( UserDataPath , ScrcpyVersion + "\\ " ) ;
3332 /// <summary>
3433 /// 用户桌面路径
3534 /// </summary>
@@ -68,19 +67,19 @@ public class Info
6867 /// <summary>
6968 /// 程序名称 不带空格
7069 /// </summary>
71- public static readonly string Name = "FreeControl" ;
70+ public const string Name = "FreeControl" ;
7271 /// <summary>
7372 /// 程序名称 带空格
7473 /// </summary>
75- public static readonly string Name2 = "Free Control" ;
74+ public const string Name2 = "Free Control" ;
7675 /// <summary>
7776 /// scrcpy标题
7877 /// </summary>
79- public static readonly string ScrcpyTitle = "FreeControlScrcpy" ;
78+ public const string ScrcpyTitle = "FreeControlScrcpy" ;
8079 /// <summary>
8180 /// 程序名称 带版本号
8281 /// </summary>
83- public static string NameVersion { get ; set ; }
82+ public static readonly string NameVersion = $ " { Name } v { Program . Version } " ;
8483 }
8584
8685 /// <summary>
@@ -186,22 +185,21 @@ public static void SetUserData(Setting userData)
186185 /// </summary>
187186 public void InitPdone ( )
188187 {
189- // 获取程序集信息
190- Assembly asm = Assembly . GetExecutingAssembly ( ) ;
191- FileVersionInfo fvi = FileVersionInfo . GetVersionInfo ( asm . Location ) ;
188+ if ( Directory . Exists ( _Setting . CustomScrcpyPath ) )
189+ {
190+ ScrcpyPath = _Setting . CustomScrcpyPath ;
191+ if ( ! ScrcpyPath . EndsWith ( "/" ) && ! ScrcpyPath . EndsWith ( "\\ " ) )
192+ {
193+ ScrcpyPath += "/" ;
194+ }
195+ }
192196 // adb路径
193197 ADB . ADBPath = $@ "{ ScrcpyPath } ";
194198 // 增加adb执行文件系统变量
195199 ADB . AddEnvironmentPath ( ScrcpyPath ) ;
196- // 是否重新加载资源包
197- bool reload = false ;
198- if ( _Setting . Version != fvi . ProductVersion )
199- {
200- reload = true ;
201- _Setting . Version = fvi . ProductVersion ;
202- }
200+ _Setting . Version = Program . Version ;
203201 // 提取资源
204- ExtractResource ( reload ) ;
202+ ExtractResource ( ) ;
205203 if ( _Setting . MainWindowX != 0 || _Setting . MainWindowY != 0 )
206204 {
207205 // 避免异常坐标导致窗口无法看到 同时需要考虑双屏时的负坐标 三屏或以上暂时无法测试与兼容
@@ -277,7 +275,6 @@ public void InitPdone()
277275 #endregion
278276
279277 #region 设置标题和图标
280- Info . NameVersion = $ "FreeControl v{ fvi . ProductVersion } ";
281278 Text = Info . NameVersion ;
282279 ledTitle . Text = Info . NameVersion ;
283280 ledTitle . CharCount = 19 ;
@@ -335,18 +332,14 @@ public void InitPdone()
335332 /// <summary>
336333 /// 提取内置资源
337334 /// </summary>
338- private void ExtractResource ( bool reload = false )
335+ private void ExtractResource ( )
339336 {
340337 string tempFileName = "temp.zip" ;
341- // 如果重新加载 且旧目录存在 删除后重新解压资源
342- if ( reload && Directory . Exists ( ScrcpyPath ) )
343- {
344- Directory . Delete ( ScrcpyPath , true ) ;
345- }
346338 if ( ! Directory . Exists ( ScrcpyPath ) )
347339 {
340+ _Setting . CustomScrcpyPath = ScrcpyPath ;
348341 Directory . CreateDirectory ( ScrcpyPath ) ;
349- File . WriteAllBytes ( ScrcpyPath + tempFileName , Properties . Resources . scrcpy_win64_v2_4 ) ;
342+ File . WriteAllBytes ( ScrcpyPath + tempFileName , Properties . Resources . scrcpy_win32_v3_0 ) ;
350343 // 解压缩
351344 ZipFile . ExtractToDirectory ( ScrcpyPath + tempFileName , UserDataPath ) ;
352345 // 解压完成删除压缩包
0 commit comments