提交记录修改Core/Core.csproj+5 −0看文件
新增Core/Librarys/SystemCommon.cs+51 −0看文件
修改Core/Servicers/Instances/Main.cs+4 −2看文件
修改Core/packages.config+1 −0看文件
新增UI/Properties/app.manifest+73 −0看文件
修改UI/UI.csproj+11 −0看文件
新增UI/app.manifest+73 −0看文件
| @@ -65,6 +65,9 @@ | ||
| 65 | 65 | <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> |
| 66 | 66 | <HintPath>..\packages\EntityFramework.6.3.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> |
| 67 | 67 | </Reference> |
| 68 | 新增: <Reference Include="Microsoft.Win32.TaskScheduler, Version=2.10.1.0, Culture=neutral, PublicKeyToken=e25603a88b3aa7da, processorArchitecture=MSIL"> | |
| 69 | 新增: <HintPath>..\packages\TaskScheduler.2.10.1\lib\net452\Microsoft.Win32.TaskScheduler.dll</HintPath> | |
| 70 | 新增: </Reference> | |
| 68 | 71 | <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> |
| 69 | 72 | <HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> |
| 70 | 73 | </Reference> |
| @@ -85,6 +88,7 @@ | ||
| 85 | 88 | <HintPath>..\packages\System.Data.SQLite.Linq.1.0.115.5\lib\net46\System.Data.SQLite.Linq.dll</HintPath> |
| 86 | 89 | </Reference> |
| 87 | 90 | <Reference Include="System.Drawing" /> |
| 91 | 新增: <Reference Include="System.IO.Compression, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" /> | |
| 88 | 92 | <Reference Include="System.Management" /> |
| 89 | 93 | <Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> |
| 90 | 94 | <HintPath>..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll</HintPath> |
| @@ -116,6 +120,7 @@ | ||
| 116 | 120 | <Compile Include="Librarys\SQLite\SQLiteBuilder.cs" /> |
| 117 | 121 | <Compile Include="Librarys\SQLite\SQLiteConfiguration.cs" /> |
| 118 | 122 | <Compile Include="Librarys\SQLite\TaiDbContext.cs" /> |
| 123 | 新增: <Compile Include="Librarys\SystemCommon.cs" /> | |
| 119 | 124 | <Compile Include="Librarys\Time.cs" /> |
| 120 | 125 | <Compile Include="Librarys\Win32API.cs" /> |
| 121 | 126 | <Compile Include="Models\AppModel.cs" /> |
| @@ -0,0 +1,51 @@ | ||
| 1 | 新增:using Microsoft.Win32; | |
| 2 | 新增:using Microsoft.Win32.TaskScheduler; | |
| 3 | 新增:using System; | |
| 4 | 新增:using System.Collections.Generic; | |
| 5 | 新增:using System.IO; | |
| 6 | 新增:using System.Linq; | |
| 7 | 新增:using System.Text; | |
| 8 | 新增:using System.Threading.Tasks; | |
| 9 | 新增: | |
| 10 | 新增:namespace Core.Librarys | |
| 11 | 新增:{ | |
| 12 | 新增: public class SystemCommon | |
| 13 | 新增: { | |
| 14 | 新增: /// <summary> | |
| 15 | 新增: /// 设置开机启动 | |
| 16 | 新增: /// </summary> | |
| 17 | 新增: /// <param name="startup"></param> | |
| 18 | 新增: /// <returns></returns> | |
| 19 | 新增: public static bool SetStartup(bool startup = true) | |
| 20 | 新增: { | |
| 21 | 新增: string TaskName = "Tai task"; | |
| 22 | 新增: var logonUser = System.Security.Principal.WindowsIdentity.GetCurrent().Name; | |
| 23 | 新增: string tai = Path.Combine( | |
| 24 | 新增: AppDomain.CurrentDomain.BaseDirectory, | |
| 25 | 新增: "Tai.exe"); | |
| 26 | 新增: string taskDescription = "Tai开机自启服务"; | |
| 27 | 新增: | |
| 28 | 新增: using (var taskService = new TaskService()) | |
| 29 | 新增: { | |
| 30 | 新增: var tasks = taskService.RootFolder.GetTasks(new System.Text.RegularExpressions.Regex(TaskName)); | |
| 31 | 新增: foreach (var t in tasks) | |
| 32 | 新增: { | |
| 33 | 新增: taskService.RootFolder.DeleteTask(t.Name); | |
| 34 | 新增: } | |
| 35 | 新增: | |
| 36 | 新增: if (startup) | |
| 37 | 新增: { | |
| 38 | 新增: var task = taskService.NewTask(); | |
| 39 | 新增: task.RegistrationInfo.Description = taskDescription; | |
| 40 | 新增: task.Triggers.Add(new LogonTrigger { UserId = logonUser }); | |
| 41 | 新增: task.Principal.RunLevel = TaskRunLevel.Highest; | |
| 42 | 新增: task.Actions.Add(new ExecAction(tai, null, AppDomain.CurrentDomain.BaseDirectory)); | |
| 43 | 新增: taskService.RootFolder.RegisterTaskDefinition(TaskName, task); | |
| 44 | 新增: } | |
| 45 | 新增: } | |
| 46 | 新增: return false; | |
| 47 | 新增: } | |
| 48 | 新增: | |
| 49 | 新增: | |
| 50 | 新增: } | |
| 51 | 新增:} | |
| @@ -114,7 +114,7 @@ namespace Core.Servicers.Instances | ||
| 114 | 114 | if (oldConfig != newConfig) |
| 115 | 115 | { |
| 116 | 116 | // 处理开机自启 |
| 117 | 删除: Shortcut.SetStartup(newConfig.General.IsStartatboot); | |
| 117 | 新增: SystemCommon.SetStartup(newConfig.General.IsStartatboot); | |
| 118 | 118 | |
| 119 | 119 | // 更新忽略规则 |
| 120 | 120 | UpdateConfigIgnoreProcess(); |
| @@ -360,11 +360,13 @@ namespace Core.Servicers.Instances | ||
| 360 | 360 | HandleLinks(activeProcess, seconds, time); |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 新增: Logger.Info("status:" + sleepStatus + ",process:" + activeProcess + ",seconds:" + seconds + ",start:" + activeStartTime.ToString() + ",end:" + DateTime.Now.ToString()); | |
| 364 | 新增: | |
| 363 | 365 | activeStartTime = DateTime.Now; |
| 364 | 366 | |
| 365 | 367 | OnUpdateTime?.Invoke(this, null); |
| 366 | 368 | |
| 367 | 删除: Logger.Info("【" + sleepStatus + "】进程:" + activeProcess + " 更新时间:" + seconds + ",开始时间:" + activeStartTime.ToString() + ",当前时间:" + DateTime.Now.ToString()); | |
| 369 | 新增: | |
| 368 | 370 | } |
| 369 | 371 | } |
| 370 | 372 | |
| @@ -12,4 +12,5 @@ | ||
| 12 | 12 | <package id="System.Memory" version="4.5.3" targetFramework="net461" /> |
| 13 | 13 | <package id="System.Numerics.Vectors" version="4.4.0" targetFramework="net461" /> |
| 14 | 14 | <package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net461" /> |
| 15 | 新增: <package id="TaskScheduler" version="2.10.1" targetFramework="net461" /> | |
| 15 | 16 | </packages> |
| 文件末尾没有换行 | ||
| @@ -0,0 +1,73 @@ | ||
| 1 | 新增:<?xml version="1.0" encoding="utf-8"?> | |
| 2 | 新增:<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"> | |
| 3 | 新增: <assemblyIdentity version="1.0.0.0" name="MyApplication.app" /> | |
| 4 | 新增: <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> | |
| 5 | 新增: <security> | |
| 6 | 新增: <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> | |
| 7 | 新增: <!-- UAC 清单选项 | |
| 8 | 新增: 如果想要更改 Windows 用户帐户控制级别,请使用 | |
| 9 | 新增: 以下节点之一替换 requestedExecutionLevel 节点。 | |
| 10 | 新增: | |
| 11 | 新增: <requestedExecutionLevel level="asInvoker" uiAccess="false" /> | |
| 12 | 新增: <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> | |
| 13 | 新增: <requestedExecutionLevel level="highestAvailable" uiAccess="false" /> | |
| 14 | 新增: | |
| 15 | 新增: 指定 requestedExecutionLevel 元素将禁用文件和注册表虚拟化。 | |
| 16 | 新增: 如果你的应用程序需要此虚拟化来实现向后兼容性,则移除此 | |
| 17 | 新增: 元素。 | |
| 18 | 新增: --> | |
| 19 | 新增: <requestedExecutionLevel level="asInvoker" uiAccess="false" /> | |
| 20 | 新增: </requestedPrivileges> | |
| 21 | 新增: <applicationRequestMinimum> | |
| 22 | 新增: <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" /> | |
| 23 | 新增: <defaultAssemblyRequest permissionSetReference="Custom" /> | |
| 24 | 新增: </applicationRequestMinimum> | |
| 25 | 新增: </security> | |
| 26 | 新增: </trustInfo> | |
| 27 | 新增: <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> | |
| 28 | 新增: <application> | |
| 29 | 新增: <!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的 | |
| 30 | 新增: Windows 版本的列表。取消评论适当的元素, | |
| 31 | 新增: Windows 将自动选择最兼容的环境。 --> | |
| 32 | 新增: <!-- Windows Vista --> | |
| 33 | 新增: <!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />--> | |
| 34 | 新增: <!-- Windows 7 --> | |
| 35 | 新增: <!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />--> | |
| 36 | 新增: <!-- Windows 8 --> | |
| 37 | 新增: <!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />--> | |
| 38 | 新增: <!-- Windows 8.1 --> | |
| 39 | 新增: <!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />--> | |
| 40 | 新增: <!-- Windows 10 --> | |
| 41 | 新增: <!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />--> | |
| 42 | 新增: </application> | |
| 43 | 新增: </compatibility> | |
| 44 | 新增: <!-- 指示该应用程序可感知 DPI 且 Windows 在 DPI 较高时将不会对其进行 | |
| 45 | 新增: 自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI,无需 | |
| 46 | 新增: 选择加入。选择加入此设置的 Windows 窗体应用程序(面向 .NET Framework 4.6)还应 | |
| 47 | 新增: 在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。 | |
| 48 | 新增: | |
| 49 | 新增: 将应用程序设为感知长路径。请参阅 https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation --> | |
| 50 | 新增: <!-- | |
| 51 | 新增: <application xmlns="urn:schemas-microsoft-com:asm.v3"> | |
| 52 | 新增: <windowsSettings> | |
| 53 | 新增: <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware> | |
| 54 | 新增: <longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware> | |
| 55 | 新增: </windowsSettings> | |
| 56 | 新增: </application> | |
| 57 | 新增: --> | |
| 58 | 新增: <!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) --> | |
| 59 | 新增: <!-- | |
| 60 | 新增: <dependency> | |
| 61 | 新增: <dependentAssembly> | |
| 62 | 新增: <assemblyIdentity | |
| 63 | 新增: type="win32" | |
| 64 | 新增: name="Microsoft.Windows.Common-Controls" | |
| 65 | 新增: version="6.0.0.0" | |
| 66 | 新增: processorArchitecture="*" | |
| 67 | 新增: publicKeyToken="6595b64144ccf1df" | |
| 68 | 新增: language="*" | |
| 69 | 新增: /> | |
| 70 | 新增: </dependentAssembly> | |
| 71 | 新增: </dependency> | |
| 72 | 新增: --> | |
| 73 | 新增:</assembly> | |
| 文件末尾没有换行 | ||
| @@ -72,6 +72,15 @@ | ||
| 72 | 72 | <ErrorReport>prompt</ErrorReport> |
| 73 | 73 | <Prefer32Bit>true</Prefer32Bit> |
| 74 | 74 | </PropertyGroup> |
| 75 | 新增: <PropertyGroup> | |
| 76 | 新增: <TargetZone>LocalIntranet</TargetZone> | |
| 77 | 新增: </PropertyGroup> | |
| 78 | 新增: <PropertyGroup> | |
| 79 | 新增: <GenerateManifests>false</GenerateManifests> | |
| 80 | 新增: </PropertyGroup> | |
| 81 | 新增: <PropertyGroup> | |
| 82 | 新增: <ApplicationManifest>app.manifest</ApplicationManifest> | |
| 83 | 新增: </PropertyGroup> | |
| 75 | 84 | <ItemGroup> |
| 76 | 85 | <Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> |
| 77 | 86 | <HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.6.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath> |
| @@ -405,7 +414,9 @@ | ||
| 405 | 414 | <Generator>ResXFileCodeGenerator</Generator> |
| 406 | 415 | <LastGenOutput>Resources.Designer.cs</LastGenOutput> |
| 407 | 416 | </EmbeddedResource> |
| 417 | 新增: <None Include="app.manifest" /> | |
| 408 | 418 | <None Include="packages.config" /> |
| 419 | 新增: <None Include="Properties\app.manifest" /> | |
| 409 | 420 | <None Include="Properties\Settings.settings"> |
| 410 | 421 | <Generator>SettingsSingleFileGenerator</Generator> |
| 411 | 422 | <LastGenOutput>Settings.Designer.cs</LastGenOutput> |
| @@ -0,0 +1,73 @@ | ||
| 1 | 新增:<?xml version="1.0" encoding="utf-8"?> | |
| 2 | 新增:<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"> | |
| 3 | 新增: <assemblyIdentity version="1.0.0.0" name="MyApplication.app" /> | |
| 4 | 新增: <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> | |
| 5 | 新增: <security> | |
| 6 | 新增: <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> | |
| 7 | 新增: <!-- UAC 清单选项 | |
| 8 | 新增: 如果想要更改 Windows 用户帐户控制级别,请使用 | |
| 9 | 新增: 以下节点之一替换 requestedExecutionLevel 节点。 | |
| 10 | 新增: | |
| 11 | 新增: <requestedExecutionLevel level="asInvoker" uiAccess="false" /> | |
| 12 | 新增: <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> | |
| 13 | 新增: <requestedExecutionLevel level="highestAvailable" uiAccess="false" /> | |
| 14 | 新增: | |
| 15 | 新增: 指定 requestedExecutionLevel 元素将禁用文件和注册表虚拟化。 | |
| 16 | 新增: 如果你的应用程序需要此虚拟化来实现向后兼容性,则移除此 | |
| 17 | 新增: 元素。 | |
| 18 | 新增: --> | |
| 19 | 新增: <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> | |
| 20 | 新增: </requestedPrivileges> | |
| 21 | 新增: <applicationRequestMinimum> | |
| 22 | 新增: <PermissionSet Unrestricted="true" ID="Custom" SameSite="site" /> | |
| 23 | 新增: <defaultAssemblyRequest permissionSetReference="Custom" /> | |
| 24 | 新增: </applicationRequestMinimum> | |
| 25 | 新增: </security> | |
| 26 | 新增: </trustInfo> | |
| 27 | 新增: <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> | |
| 28 | 新增: <application> | |
| 29 | 新增: <!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的 | |
| 30 | 新增: Windows 版本的列表。取消评论适当的元素, | |
| 31 | 新增: Windows 将自动选择最兼容的环境。 --> | |
| 32 | 新增: <!-- Windows Vista --> | |
| 33 | 新增: <!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />--> | |
| 34 | 新增: <!-- Windows 7 --> | |
| 35 | 新增: <!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />--> | |
| 36 | 新增: <!-- Windows 8 --> | |
| 37 | 新增: <!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />--> | |
| 38 | 新增: <!-- Windows 8.1 --> | |
| 39 | 新增: <!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />--> | |
| 40 | 新增: <!-- Windows 10 --> | |
| 41 | 新增: <!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />--> | |
| 42 | 新增: </application> | |
| 43 | 新增: </compatibility> | |
| 44 | 新增: <!-- 指示该应用程序可感知 DPI 且 Windows 在 DPI 较高时将不会对其进行 | |
| 45 | 新增: 自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI,无需 | |
| 46 | 新增: 选择加入。选择加入此设置的 Windows 窗体应用程序(面向 .NET Framework 4.6)还应 | |
| 47 | 新增: 在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。 | |
| 48 | 新增: | |
| 49 | 新增: 将应用程序设为感知长路径。请参阅 https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation --> | |
| 50 | 新增: <!-- | |
| 51 | 新增: <application xmlns="urn:schemas-microsoft-com:asm.v3"> | |
| 52 | 新增: <windowsSettings> | |
| 53 | 新增: <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware> | |
| 54 | 新增: <longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware> | |
| 55 | 新增: </windowsSettings> | |
| 56 | 新增: </application> | |
| 57 | 新增: --> | |
| 58 | 新增: <!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) --> | |
| 59 | 新增: <!-- | |
| 60 | 新增: <dependency> | |
| 61 | 新增: <dependentAssembly> | |
| 62 | 新增: <assemblyIdentity | |
| 63 | 新增: type="win32" | |
| 64 | 新增: name="Microsoft.Windows.Common-Controls" | |
| 65 | 新增: version="6.0.0.0" | |
| 66 | 新增: processorArchitecture="*" | |
| 67 | 新增: publicKeyToken="6595b64144ccf1df" | |
| 68 | 新增: language="*" | |
| 69 | 新增: /> | |
| 70 | 新增: </dependentAssembly> | |
| 71 | 新增: </dependency> | |
| 72 | 新增: --> | |
| 73 | 新增:</assembly> | |
| 文件末尾没有换行 | ||

