1 Commits
main ... UI

Author SHA1 Message Date
1c473f88b9 更新ui显示 2025-07-02 13:40:06 +08:00
10 changed files with 1685 additions and 3419 deletions

Binary file not shown.

BIN
7z.dll

Binary file not shown.

View File

@@ -1,82 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<HVMProject version ="2">
<Assemblies>
<assembly>
<path>.\bin\x86\Release\CheckDownload.exe</path>
<obfuscate>true</obfuscate>
</assembly>
</Assemblies>
<Output>
<path>.\bin\Debug_Protected</path>
<runtime>HVMRuntm.dll</runtime>
<runtime64>HVMRun64.dll</runtime64>
<X64Optimize>true</X64Optimize>
<LibMode>1</LibMode>
<EmbedRuntime>0</EmbedRuntime>
<shrink>true</shrink>
<SingleEXE>true</SingleEXE>
<EXE>
<Main>CheckDownload.exe</Main>
<PackType>1</PackType>
<EntryType>0</EntryType>
<LoadType>0</LoadType>
<Assemblies>
<assembly>
<path>.\bin\x86\Release\CheckDownload.exe.config</path>
<datafile>true</datafile>
</assembly>
<assembly>
<path>.\bin\x86\Release\CheckDownload.pdb</path>
<datafile>true</datafile>
</assembly>
<assembly>
<path>.\bin\x86\Release\7z.dll</path>
<datafile>true</datafile>
</assembly>
<SplashConfig>
<Width>600</Width>
<Height>400</Height>
<iAutoClose>0</iAutoClose>
<Image></Image>
<msg1>Loading...</msg1>
<msg2>Starting...</msg2>
<title></title>
</SplashConfig>
</Assemblies>
</EXE>
</Output>
<Settings>
<EncryptComplierGen>true</EncryptComplierGen>
<AntiDump>true</AntiDump>
<EncryptNew>true</EncryptNew>
<EncryptRes>true</EncryptRes>
<EncryptBlob>true</EncryptBlob>
<EncryptUS>true</EncryptUS>
<HVM>true</HVM>
<HVM2>true</HVM2>
<HVMSig>true</HVMSig>
<HVMEH>true</HVMEH>
<HVMStr>true</HVMStr>
<Level>4</Level>
<Level2>3</Level2>
<CompatLevel>15</CompatLevel>
<AntiTrace>true</AntiTrace>
<HVMAntiTrace>true</HVMAntiTrace>
<HVMProxyMethod>true</HVMProxyMethod>
<AnonymousProtection>2</AnonymousProtection>
<StripConstantsString>true</StripConstantsString>
</Settings>
<Obfuscation>
<AutoRename>true</AutoRename>
<ObILCode>true</ObILCode>
<ObMeta>true</ObMeta>
<RenameMode>2</RenameMode>
</Obfuscation>
<TrialSettings>
</TrialSettings>
<LicenseSettings>
<AddBiosID>true</AddBiosID>
<AddMacID>true</AddMacID>
<MasterKey></MasterKey>
</LicenseSettings>
</HVMProject>

View File

@@ -89,12 +89,6 @@
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SevenZipExtractor, Version=1.0.19.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\SevenZipExtractor.1.0.19\lib\net45\SevenZipExtractor.dll</HintPath>
</Reference>
<Reference Include="SevenZipSharp, Version=0.64.3890.29348, Culture=neutral, PublicKeyToken=20de82c62b055c88, processorArchitecture=MSIL">
<HintPath>packages\SevenZipSharp.0.64\lib\SevenZipSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
@@ -137,14 +131,16 @@
<Reference Include="System.Configuration" />
</ItemGroup>
<ItemGroup>
<Compile Include="Update.cs" />
<Compile Include="Update.Designer.cs">
<DependentUpon>Update.cs</DependentUpon>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Update.resx">
<DependentUpon>Update.cs</DependentUpon>
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
@@ -181,24 +177,15 @@
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Content Include="7z.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用"NuGet 程序包还原"可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('packages\Fody.6.9.2\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Fody.6.9.2\build\Fody.targets'))" />
<Error Condition="!Exists('packages\Costura.Fody.6.0.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Costura.Fody.6.0.0\build\Costura.Fody.props'))" />
<Error Condition="!Exists('packages\Costura.Fody.6.0.0\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Costura.Fody.6.0.0\build\Costura.Fody.targets'))" />
<!-- <Error Condition="!Exists('packages\SevenZipSharp.Interop.19.1.0\build\SevenZipSharp.Interop.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\SevenZipSharp.Interop.19.1.0\build\SevenZipSharp.Interop.targets'))" /> -->
<!-- <Error Condition="!Exists('packages\SevenZipExtractor.1.0.19\build\SevenZipExtractor.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\SevenZipExtractor.1.0.19\build\SevenZipExtractor.targets'))" /> -->
<Error Condition="!Exists('packages\Fody.6.9.2\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Fody.6.9.2\build\Fody.targets'))" />
</Target>
<Import Project="packages\Fody.6.9.2\build\Fody.targets" Condition="Exists('packages\Fody.6.9.2\build\Fody.targets')" />
<Import Project="packages\Costura.Fody.6.0.0\build\Costura.Fody.targets" Condition="Exists('packages\Costura.Fody.6.0.0\build\Costura.Fody.targets')" />
<!-- <Import Project="packages\SevenZipSharp.Interop.19.1.0\build\SevenZipSharp.Interop.targets" Condition="Exists('packages\SevenZipSharp.Interop.19.1.0\build\SevenZipSharp.Interop.targets')" /> -->
<!-- <Import Project="packages\SevenZipExtractor.1.0.19\build\SevenZipExtractor.targets" Condition="Exists('packages\SevenZipExtractor.1.0.19\build\SevenZipExtractor.targets')" /> -->
<Import Project="packages\Fody.6.9.2\build\Fody.targets" Condition="Exists('packages\Fody.6.9.2\build\Fody.targets')" />
</Project>

View File

@@ -28,63 +28,66 @@
/// </summary>
private void InitializeComponent()
{
this.Update_Pro = new System.Windows.Forms.ProgressBar();
this.Status_Box = new System.Windows.Forms.Label();
this.Count_Box = new System.Windows.Forms.Label();
this.Size_Box = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// Update_Pro
//
this.Update_Pro.Location = new System.Drawing.Point(12, 36);
this.Update_Pro.Name = "Update_Pro";
this.Update_Pro.Size = new System.Drawing.Size(339, 23);
this.Update_Pro.TabIndex = 1;
//
// Status_Box
//
this.Status_Box.Location = new System.Drawing.Point(12, 12);
this.Status_Box.Name = "Status_Box";
this.Status_Box.Size = new System.Drawing.Size(148, 12);
this.Status_Box.TabIndex = 2;
this.Status_Box.Text = "...";
//
// Count_Box
//
this.Count_Box.Location = new System.Drawing.Point(296, 12);
this.Count_Box.Name = "Count_Box";
this.Count_Box.Size = new System.Drawing.Size(55, 13);
this.Count_Box.TabIndex = 3;
this.Count_Box.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// Size_Box
//
this.Size_Box.Location = new System.Drawing.Point(166, 12);
this.Size_Box.Name = "Size_Box";
this.Size_Box.Size = new System.Drawing.Size(130, 13);
this.Size_Box.TabIndex = 4;
this.Size_Box.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// Update
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(363, 73);
this.ControlBox = false;
this.Controls.Add(this.Size_Box);
this.Controls.Add(this.Count_Box);
this.Controls.Add(this.Status_Box);
this.Controls.Add(this.Update_Pro);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Update";
this.ShowInTaskbar = false;
this.Text = "自动更新";
this.TopMost = true;
this.Load += new System.EventHandler(this.Update_Load);
this.ResumeLayout(false);
this.Update_Pro = new System.Windows.Forms.ProgressBar();
this.Status_Box = new System.Windows.Forms.Label();
this.Count_Box = new System.Windows.Forms.Label();
this.Size_Box = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// Update_Pro
//
this.Update_Pro.Location = new System.Drawing.Point(12, 36);
this.Update_Pro.Name = "Update_Pro";
this.Update_Pro.Size = new System.Drawing.Size(339, 23);
this.Update_Pro.TabIndex = 1;
//
// Status_Box
//
this.Status_Box.AutoEllipsis = true;
this.Status_Box.Location = new System.Drawing.Point(12, 12);
this.Status_Box.Name = "Status_Box";
this.Status_Box.Size = new System.Drawing.Size(165, 12);
this.Status_Box.TabIndex = 2;
this.Status_Box.Text = "...";
//
// Count_Box
//
this.Count_Box.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.Count_Box.Location = new System.Drawing.Point(306, 12);
this.Count_Box.Name = "Count_Box";
this.Count_Box.Size = new System.Drawing.Size(50, 12);
this.Count_Box.TabIndex = 3;
this.Count_Box.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// Size_Box
//
this.Size_Box.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.Size_Box.Location = new System.Drawing.Point(183, 12);
this.Size_Box.Name = "Size_Box";
this.Size_Box.Size = new System.Drawing.Size(117, 12);
this.Size_Box.TabIndex = 4;
this.Size_Box.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// Update
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(363, 73);
this.ControlBox = false;
this.Controls.Add(this.Size_Box);
this.Controls.Add(this.Count_Box);
this.Controls.Add(this.Status_Box);
this.Controls.Add(this.Update_Pro);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Update";
this.ShowInTaskbar = false;
this.Text = "自动更新";
this.TopMost = true;
this.Load += new System.EventHandler(this.Update_Load);
this.ResumeLayout(false);
}
#endregion

1496
Form1.cs Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,120 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

142
README.md
View File

@@ -1,141 +1 @@
# CheckDownload - 智能文件更新器
这是一个C#编写的高效、智能的文件更新与下载工具。它被设计用于自动比较本地文件与服务器上的文件清单,并只下载有变动或缺失的文件,同时具备诸多高级功能以确保更新过程的稳定与顺畅。
## 核心功能
- **MD5校验更新**:通过比较本地与远程服务器上的 `md5.json` 文件,精确识别需要更新的文件,实现增量更新,节省带宽和时间。
- **多下载源支持**
- **阿里云OSS**:作为主要的稳定文件存储。
- **123网盘**作为备用下载链路通过动态生成鉴权URL进行下载。
- **智能基准目录检测**:程序能够根据 `md5.json` 中的文件结构,自动定位项目的主目录,确保即使程序被移动到子文件夹内,文件也能被更新到正确的位置。
- **并发下载与失败重试**
- 支持多线程并发下载,大幅提升下载效率。
- 内置下载失败自动重试机制,应对临时的网络波动。
- **IP直连与DNS容灾**当通过域名访问下载服务器失败时程序会自动尝试通过备用DNS服务解析IP地址并直接使用IP进行连接极大地提高了在复杂网络环境下的下载成功率。
## 高级特性与处理逻辑
- **智能解压 `tim.7z`**
- **精确进程控制**:在更新完成后,如果找到 `tim.7z` 压缩包,程序会先将其内容解压到一个临时隔离目录。
- **条件判断**:仅当在解压内容中检测到 `tim.dll` 时,程序才会去关闭正在运行的 `tim.exe` 进程,以避免文件占用。
- **安全覆盖**:完成上述检查和操作后,再将所有文件移动到最终的目标位置。这个过程避免了不必要地中断用户正在运行的程序。
- **自动设置管理员权限**:对于从 `tim.7z` 中解压出的所有 `.exe` 可执行文件程序会自动在Windows注册表中为其添加"以管理员身份运行"的兼容性设置,确保这些程序拥有足够的权限来正常工作。
- **处理文件占用**
- **自动解锁**在移动文件时如果目标文件被占用程序会先尝试等待1秒后重试。
- **下次启动时替换**:如果文件仍然被占用,程序会自动创建一个批处理脚本 (`.bat`),该脚本会在主程序退出后运行,从而在系统下次启动或空闲时完成文件的替换。
- **特定进程的自动关闭**
- 在下载任何 `.exe` 文件之前,程序会先查找并结束同名的正在运行的进程。
- 如果更新列表中包含 `tim.dll`,程序会提前结束 `tim.exe` 进程,以防止文件锁定。
- **数据库文件豁免**:程序在进行文件比较时,会自动跳过 `.db``.db3` 结尾的数据库文件,防止因这些文件频繁变动而导致的错误更新。
- **启动稳定性**:修复了在程序启动阶段可能因目录路径未初始化而导致的严重错误 (`ArgumentNullException`),确保了程序的健壮性。
## 用户界面
- **实时进度显示**:通过进度条、已完成数量/总数以及 **已下载总量(实时速度)** 的形式清晰地展示更新进度。已下载总量会包含已存在于临时目录的有效文件,速度则只计算运行时下载的部分。
- **简洁的状态反馈**:界面会以 `下载:文件名...` 的格式显示当前任务,过长的文件名会被自动截断,避免信息刷屏。
- **友好的错误提示**:当发生严重错误时,会弹出简明扼要的错误信息窗口,而不是难以理解的完整堆栈跟踪。
- **自动定位与退出**:窗体启动时会自动停靠在屏幕右下角,更新完成后会自动关闭,对用户干扰极小。
## 配置
程序的核心参数(如最大并发下载数、重试次数等)可以通过 `App.config` 文件进行调整。
```csharp
// App.config 示例
<appSettings>
<add key="MaxConcurrentDownloads" value="4" />
<add key="MaxDownloadRetries" value="2" />
</appSettings>
```
这个工具集成了多种故障处理和智能逻辑,旨在提供一个无人值守、高度自动化的文件更新体验。
## 🚀 主要功能
### 📥 多源下载支持
- **123盘云存储**: (UID: `1826795402`, Path: `/1826795402/KeyAuth`) 支持主备域名自动切换,提供高可用性下载服务。
- **阿里云OSS**: 备用下载源,确保文件下载的可靠性。
- **智能DNS解析**: 使用多个DNS服务器提高域名解析成功率。
### 🔄 智能更新机制
- **MD5完整性验证**: 下载前后进行MD5校验确保文件完整性。
- **增量更新**: 仅下载已变更的文件,节省带宽和时间。
- **断点续传支持**: 通过检查本地临时文件实现若文件已存在且MD5匹配则跳过下载。
- **并发下载**: 可配置的多线程并发下载,显著提升下载速度。
### 🛡️ 文件处理与安全
- **文件占用处理**: 智能检测并处理被占用的文件,并创建延迟替换脚本。
- **临时文件管理**: 自动清理临时文件,保持系统整洁。
- **路径智能识别**: 基于MD5数据自动识别项目基准目录。
### 📦 自动解压功能
- **7z格式支持**: 内置7z解压引擎支持多种压缩格式。
- **自动权限设置**: 解压后自动为exe文件设置管理员运行权限。
- **多架构兼容**: 自动选择32位/64位解压库适配不同运行环境。
### 🔧 错误处理与重试
- **多次重试机制**: 下载失败自动重试,可配置重试次数。
- **异常处理**: 完善的异常捕获和处理机制。
- **状态实时显示**: 实时显示下载进度、状态和错误信息。
## 🏗️ 技术架构
### 核心组件
- **.NET Framework**: 基于稳定的.NET Framework构建。
- **异步编程**: 全面采用async/await模式确保UI响应性。
- **多线程下载**: 使用SemaphoreSlim控制并发数量。
- **资源嵌入**: 将依赖库嵌入程序,实现单文件部署。
### 依赖库
- **Aliyun.OSS.SDK**: 阿里云对象存储服务支持。
- **Newtonsoft.Json**: JSON数据处理。
- **SevenZipExtractor**: 7z压缩文件解压支持。
## 📋 配置说明
### 应用程序配置
程序支持通过App.config进行配置
```xml
<appSettings>
<!-- 最大并发下载数量 -->
<add key="MaxConcurrentDownloads" value="4" />
<!-- 最大下载重试次数 -->
<add key="MaxDownloadRetries" value="2" />
</appSettings>
```
### MD5文件格式
程序使用JSON格式的MD5文件来管理文件版本
```json
{
"version": "1.0.0",
"data": {
"program.exe": "5d41402abc4b2a76b9719d911017c592",
"lib/library.dll": "098f6bcd4621d373cade4e832627b4f6"
}
}
```
## 🔄 工作流程
1. **启动检查**: 程序启动时清理旧的更新文件 (`.new` 后缀)。
2. **下载MD5**: 从云存储下载最新的MD5文件。
3. **文件比较**: 对比本地文件与在线MD5识别需要更新的文件。
4. **并发下载**: 使用多线程下载需要更新的文件到临时目录。
5. **完整性验证**: 验证下载文件的MD5值。
6. **文件替换**: 将新文件移动到目标位置,对被占用文件创建替换脚本。
7. **7z解压**: 自动检测并解压`tim.7z`文件(如果存在)。
8. **权限设置**: 为解压的exe文件设置管理员运行权限。
9. **清理完成**: 清理临时目录,显示完成状态后退出。
## 🎯 使用场景
- **软件自动更新**: 为桌面应用程序提供自动更新功能。
- **文件同步**: 在不同设备间同步文件和配置。
- **游戏更新**: 游戏客户端的增量更新和补丁分发。
---
**注意**: 本程序需要网络连接以下载更新文件。首次运行时可能需要较长时间来下载所有必要的文件。
Check files & Download files

2994
Update.cs

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="7z" version="15.8.0" targetFramework="net472" />
<package id="Aliyun.OSS.SDK" version="2.14.1" targetFramework="net472" />
<package id="Costura.Fody" version="6.0.0" targetFramework="net472" developmentDependency="true" />
<package id="DnsClient" version="1.8.0" targetFramework="net472" />
@@ -8,9 +7,6 @@
<package id="LanzouCloudSolve" version="1.0.3" targetFramework="net472" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="9.0.6" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
<package id="SevenZipExtractor" version="1.0.19" targetFramework="net472" />
<package id="SevenZipSharp" version="0.64" targetFramework="net472" />
<package id="SevenZipSharp.Interop" version="19.1.0" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.IO.Pipelines" version="9.0.6" targetFramework="net472" />
<package id="System.Memory" version="4.5.5" targetFramework="net472" />