Skip to content

Commit b01c0ad

Browse files
committed
更新scrcpy版本
增加自定义scrcpy参数
1 parent df82252 commit b01c0ad

22 files changed

+112
-498
lines changed

FreeControl/Controller.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
using FreeControl.Utils;
2-
using Sunny.UI;
3-
using System;
1+
using System;
42
using System.Drawing;
53
using System.Windows.Forms;
4+
using FreeControl.Utils;
5+
using Sunny.UI;
66

77
namespace FreeControl
88
{

FreeControl/FreeControl.csproj

+1-2
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@
262262
<Compile Include="Utils\Logger.cs" />
263263
<Compile Include="Utils\MoveListener.cs" />
264264
<Compile Include="Utils\SysEnvironment.cs" />
265-
<Compile Include="Utils\ZipHelper.cs" />
266265
<EmbeddedResource Include="Controller.resx">
267266
<DependentUpon>Controller.cs</DependentUpon>
268267
</EmbeddedResource>
@@ -283,7 +282,7 @@
283282
</EmbeddedResource>
284283
<EmbeddedResource Include="SetProt.bat" />
285284
<None Include="packages.config" />
286-
<None Include="Resources\scrcpy-win64-v2.4.zip" />
285+
<None Include="Resources\scrcpy-win32-v3.0.zip" />
287286
<None Include="Update.en.md" />
288287
<None Include="Update.md" />
289288
</ItemGroup>

FreeControl/FreeControl.sln

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.5.002.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FreeControl", "FreeControl.csproj", "{A51E6D71-ECD5-4EFA-AEF5-DEB23B09F28C}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{A51E6D71-ECD5-4EFA-AEF5-DEB23B09F28C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{A51E6D71-ECD5-4EFA-AEF5-DEB23B09F28C}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{A51E6D71-ECD5-4EFA-AEF5-DEB23B09F28C}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{A51E6D71-ECD5-4EFA-AEF5-DEB23B09F28C}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {B0513970-9479-420D-9EED-BD31B7489F5E}
24+
EndGlobalSection
25+
EndGlobal

FreeControl/Main.cs

+22-29
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
using FreeControl.Utils;
2-
using Sunny.UI;
3-
using System;
1+
using System;
42
using System.Collections.Generic;
53
using System.ComponentModel;
64
using System.Diagnostics;
75
using System.Drawing;
86
using System.IO;
97
using System.IO.Compression;
108
using System.Linq;
11-
using System.Reflection;
129
using System.Threading;
1310
using System.Threading.Tasks;
1411
using System.Windows.Forms;
12+
using FreeControl.Utils;
13+
using Sunny.UI;
1514

1615
namespace 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
// 解压完成删除压缩包

FreeControl/Program.cs

+22-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
1-
using FreeControl.Utils;
2-
using System;
1+
using System;
2+
using System.Reflection;
3+
using System.Runtime.InteropServices;
34
using System.Windows.Forms;
5+
using FreeControl;
6+
using FreeControl.Utils;
7+
8+
[assembly: AssemblyTitle("在PC上控制Android设备")]//在PC上控制Android设备。
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("Pdone Technology Ltd.")]
12+
[assembly: AssemblyProduct("Free Control")]
13+
[assembly: AssemblyCopyright("Copyright © 2024 awaw.cc")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
[assembly: ComVisible(false)]
18+
19+
[assembly: Guid("ef7540e1-f2e7-4682-80ab-92354c55a4c6")]
20+
21+
[assembly: AssemblyFileVersion(Program.Version)]
22+
[assembly: AssemblyVersion(Program.Version)]
423

524
namespace FreeControl
625
{
726
static class Program
827
{
28+
public const string Version = "1.7.3";
929
/// <summary>
1030
/// 应用程序的主入口点。
1131
/// </summary>
+1-37
Original file line numberDiff line numberDiff line change
@@ -1,37 +1 @@
1-
using System.Reflection;
2-
using System.Runtime.CompilerServices;
3-
using System.Runtime.InteropServices;
4-
5-
// 有关程序集的一般信息由以下
6-
// 控制。更改这些特性值可修改
7-
// 与程序集关联的信息。
8-
[assembly: AssemblyTitle("在PC上控制Android设备")]//在PC上控制Android设备。
9-
[assembly: AssemblyDescription("")]
10-
[assembly: AssemblyConfiguration("")]
11-
[assembly: AssemblyCompany("Pdone Technology Ltd.")]
12-
[assembly: AssemblyProduct("Free Control")]
13-
[assembly: AssemblyCopyright("Copyright © 2024 awaw.cc")]
14-
[assembly: AssemblyTrademark("")]
15-
[assembly: AssemblyCulture("")]
16-
17-
// 将 ComVisible 设置为 false 会使此程序集中的类型
18-
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
19-
//请将此类型的 ComVisible 特性设置为 true。
20-
[assembly: ComVisible(false)]
21-
22-
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23-
[assembly: Guid("ef7540e1-f2e7-4682-80ab-92354c55a4c6")]
24-
25-
// 程序集的版本信息由下列四个值组成:
26-
//
27-
// 主版本
28-
// 次版本
29-
// 生成号
30-
// 修订号
31-
//
32-
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
33-
//通过使用 "*",如下所示:
34-
// [assembly: AssemblyVersion("1.0.*")]
35-
//[assembly: AssemblyVersion("1.0.0")]
36-
[assembly: AssemblyFileVersion("1.7.2")]
37-
[assembly: AssemblyVersion("1.7.2")]
1+


FreeControl/Properties/Resources.Designer.cs

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

FreeControl/Properties/Resources.resx

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@
124124
<data name="pcm" type="System.Resources.ResXFileRef, System.Windows.Forms">
125125
<value>..\Resources\pcm.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
126126
</data>
127-
<data name="scrcpy_win64_v2_4" type="System.Resources.ResXFileRef, System.Windows.Forms">
128-
<value>..\Resources\scrcpy-win64-v2.4.zip;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
127+
<data name="scrcpy_win32_v3_0" type="System.Resources.ResXFileRef, System.Windows.Forms">
128+
<value>..\Resources\scrcpy-win32-v3.0.zip;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
129129
</data>
130130
<data name="shortcut_en" type="System.Resources.ResXFileRef, System.Windows.Forms">
131131
<value>..\Resources\shortcut_en.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
Binary file not shown.
5.78 MB
Binary file not shown.
-5.65 MB
Binary file not shown.

FreeControl/Setting.cs

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
using System;
2-
using System.Collections.Generic;
1+
using System.Collections.Generic;
32
using System.ComponentModel;
4-
using System.Linq;
5-
using System.Text;
63

74
namespace FreeControl
85
{
@@ -216,5 +213,10 @@ public List<string> ControllerButton
216213
/// 自定义参数
217214
/// </summary>
218215
public string CustomArgs { get; set; } = "--keyboard=uhid";
216+
217+
/// <summary>
218+
/// 自定义Scrcpy路径
219+
/// </summary>
220+
public string CustomScrcpyPath { get; set; } = "";
219221
}
220222
}

FreeControl/Trusteeship.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using FreeControl.Utils;
2-
using System.Windows.Forms;
1+
using System.Windows.Forms;
2+
using FreeControl.Utils;
33

44
namespace FreeControl
55
{

FreeControl/Update.en.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Free Control Update Record
22

3+
## v1.7.3
4+
- Based on scrcpy v3.0(x32)
5+
- Add 'CustomScrcpyPath' parameter to customize Scrcpy directory
6+
37
## v1.7.2
48
- Fix bug
59

FreeControl/Update.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Free Control 更新记录
22

3+
## v1.7.3
4+
- 基于scrcpy v3.0(x32)
5+
- 增加 `CustomScrcpyPath` 参数用于自定义Scrcpy目录
6+
37
## v1.7.2
48
- 修复了一些bug
59

FreeControl/Utils/ADB.cs

-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
using System;
2-
using System.Collections.Generic;
32
using System.Diagnostics;
43
using System.IO;
5-
using System.Linq;
64
using System.Text;
7-
using System.Threading;
8-
using System.Threading.Tasks;
95

106
namespace FreeControl.Utils
117
{

FreeControl/Utils/Extend.cs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System.Linq;
55
using System.Reflection;
66
using System.Runtime.InteropServices;
7-
using System.Windows.Forms.VisualStyles;
87

98
namespace FreeControl.Utils
109
{

FreeControl/Utils/FileHelper.cs

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.IO;
4-
using System.Linq;
1+
using System.IO;
52
using System.Reflection;
6-
using System.Text;
73

84
namespace FreeControl.Utils
95
{

FreeControl/Utils/MoveListener.cs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Diagnostics;
33
using System.Runtime.InteropServices;
44
using System.Text;
5-
using System.Threading.Tasks;
65
using System.Timers;
76

87
namespace FreeControl.Utils

FreeControl/Utils/SysEnvironment.cs

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
using Microsoft.Win32;
2-
using System;
3-
using System.Collections.Generic;
4-
using System.ComponentModel;
5-
using System.Linq;
6-
using System.Text;
1+
using System;
2+
using Microsoft.Win32;
73

84
namespace FreeControl.Utils
95
{

0 commit comments

Comments
 (0)