Commit 6b711b8f authored by tr's avatar tr

1、工具平台:版本更新功能公测版

parent c6aae9f1
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<!--打包排除文件,半角逗号分隔-->
<add key="ExceptFiles" value="U.Memopad.dll" />
<add key="ExceptFiles" value="U.Memopad.dll"/>
<!--打包时间范围,文件最后修改时间距当前时间多少小时以内-->
<add key="PatchTimeFrame_Dll" value="1" />
<add key="PatchTimeFrame_Sql" value="720" />
<add key="PatchTimeFrame_Xml" value="720" />
<add key="PatchTimeFrame_Dll" value="1"/>
<add key="PatchTimeFrame_Sql" value="720"/>
<add key="PatchTimeFrame_Xml" value="720"/>
<add key="PatchTimeFrame_Xml" value="720" />
<add key="PatchTimeFrame_Xml" value="720"/>
<!--是否排除.pdb文件。1:排除,其他包含。-->
<add key="Exclude_PDB" value="1" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
<add key="Exclude_PDB" value="1"/>
<add key="ClientSettingsProvider.ServiceUri" value=""/>
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri=""/>
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400"/>
</providers>
</roleManager>
</system.web>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="UpdateTime" value="" />
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="ICSharpCode.SharpZipLib" publicKeyToken="1b03e6acf1164f73" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.2.10" newVersion="1.3.2.10" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
......
......@@ -12,4 +12,4 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{ACE4794E-3C69-40DF-88FF-9DA3BC81FEB2}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>AutoUpdate</RootNamespace>
<AssemblyName>AutoUpdate</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\AppHome\AutoUpdate\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="ICSharpCode.SharpZipLib, Version=1.3.2.10, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\SharpZipLib.1.3.2\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<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" />
<Compile Include="SmpDB.cs" />
<Compile Include="Utils.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ProjectFiles</ProjectView>
</PropertyGroup>
</Project>
\ No newline at end of file
namespace AutoUpdate
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(18, 12);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size(426, 103);
this.textBox1.TabIndex = 1;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(467, 130);
this.Controls.Add(this.textBox1);
this.Enabled = false;
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "自动更新";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form1_FormClosed);
this.Shown += new System.EventHandler(this.Form1_Shown);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBox1;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AutoUpdate
{
public partial class Form1 : Form
{
SmpDB _db = new SmpDB();
DataSet _ds = null;
string _link = "";
string _path = "";
string _exeName = "";
public Form1(string[] args)
{
InitializeComponent();
//
if (args.Length > 1)
{
this._path = args[0];
this._exeName = args[1];
}
}
private void Form1_Shown(object sender, EventArgs e)
{
//参数检查
if (string.IsNullOrEmpty(this._path) || string.IsNullOrEmpty(this._exeName))
{
this.textBox1.Text = $"更新路径或启动程序未指定!";
}
else
{
this.AppUpdate(); //应用更新
}
//异步等待
Task.Run(() => Thread.Sleep(2000)).Wait();
//关闭窗口
this.Close();
}
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
//启动原程序
var startup = $@"{this._path}\AppHome\{this._exeName}.exe";
if (File.Exists(startup))
{
ProcessStartInfo info = new ProcessStartInfo()
{
FileName = startup,
UseShellExecute = false,
RedirectStandardError = true,
};
new Process() { StartInfo = info }.Start();
}
}
private void AppUpdate()
{
this._link = Utils.GetDbLinkString("192.168.1.204", "sa", "sa", "FTT_Work");
this._ds = this._db.GetData(this._link, "SELECT TOP 1 * FROM dbo.FTT_AutoUpdate ORDER BY UDate DESC", "FTT_AutoUpdate");
if (this._ds.Tables[0].DefaultView.Count == 0)
{
this.textBox1.Text = "未发现新版本!";
}
else
{
//结束原进程
var pp = Process.GetProcessesByName(this._exeName);
foreach (var p in pp)
{
if (!p.HasExited)
{
p.Kill();
}
}
this.AddProcessText(10);
//获取更新数据
var drv = this._ds.Tables[0].DefaultView[0];
var fileName = drv["UName"].ToString();
var bytes = drv["UData"] as byte[];
//默认解压覆盖指定目录
var fileFullName = $@"{this._path}\{fileName}";
this.AddProcessText(30);
//创建本地更新包
File.WriteAllBytes(fileFullName, bytes);
this.AddProcessText(60);
//解压更新包到指定目录
Utils.ZipDecompress(fileFullName, this._path);
this.AddProcessText(90);
//删除更新包
File.Delete(fileFullName);
this.AddProcessText(100);
}
}
private void AddProcessText(int value)
{
this.textBox1.Text += $"进度完成{value}%\r\n";
}
}
}
<?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>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AutoUpdate
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1(args));
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("AutoUpdate")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AutoUpdate")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("ace4794e-3c69-40df-88ff-9da3bc81feb2")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace AutoUpdate.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AutoUpdate.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 覆盖当前线程的 CurrentUICulture 属性
/// 使用此强类型的资源类的资源查找。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace AutoUpdate.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//----------------------------------------------
using System.Data;
using System.Data.SqlClient;
namespace AutoUpdate
{
/// <summary>
/// 数据库操作类
/// </summary>
public class SmpDB : IDisposable
{
#region 实现接口:IDisposable
public void Dispose()
{
}
#endregion
/// <summary>
/// 获取数据表
/// </summary>
/// <param name="strLink">数据库连接字串</param>
/// <param name="strSql">SQL语句</param>
/// <param name="strTableName">表名</param>
/// <param name="Schema">是否获取结构信息</param>
/// <returns></returns>
public DataTable GetDataTable(string strLink, string strSql, string strTableName, bool Schema = true)
{
DataTable dt = new DataTable(strTableName);
SqlConnection conn = null;
try
{
conn = new SqlConnection(strLink);
conn.Open();
var ada = new SqlDataAdapter(strSql, conn);
if (Schema) ada.FillSchema(dt, SchemaType.Mapped);//取出数据结构
ada.Fill(dt);//填充数据
}
catch (Exception ex)
{
if (conn.State == ConnectionState.Open)
conn.Close();
throw (new Exception("获取数据出错:\r\n" + ex.Message));
}
return dt;
}
/// <summary>
/// 获取数据集
/// </summary>
/// <param name="strLink">数据库连接字串</param>
/// <param name="strSql">SQL语句</param>
/// <param name="strTableName">表名</param>
/// <returns></returns>
public DataSet GetData(string strLink, string strSql, string strTableName)
{
DataSet dsData = new DataSet();
SqlConnection conn = null;
SqlDataAdapter ada = null;
try
{
conn = new SqlConnection(strLink);
conn.Open();
ada = new SqlDataAdapter(strSql, conn);
ada.FillSchema(dsData, SchemaType.Mapped, strTableName);//取出数据结构
ada.Fill(dsData, strTableName);//填充数据
}
catch (Exception ex)
{
if (conn.State == ConnectionState.Open)
conn.Close();
throw (new Exception("获取数据出错:\r\n" + ex.Message));
}
return dsData;
}
/// <summary>
/// 获取数据集
/// </summary>
/// <param name="strLink">数据库连接字串</param>
/// <param name="Tables">表的扩展集合</param>
/// <param name="Schema">是否获取结构信息</param>
/// <returns></returns>
public DataSet GetData(string strLink, List<TQuery> Tables, bool Schema)
{
DataSet ds = new DataSet();
SqlConnection conn = null;
SqlCommand cmd = null;
SqlDataAdapter ada = null;
try
{
conn = new SqlConnection(strLink);
conn.Open();
foreach (TQuery t in Tables)
{
cmd = new SqlCommand(t.QuerySQL, conn);
if (t.QueryParameters.Count > 0)
{
foreach (SqlParameter para in t.QueryParameters)
{
cmd.Parameters.Add(para);
}
}
ada = new SqlDataAdapter(cmd);
if (Schema)
{
ada.FillSchema(ds, SchemaType.Mapped, t.TableName);//取出数据结构
}
ada.Fill(ds, t.TableName);//填充数据
}
}
catch (Exception ex)
{
throw (new Exception("获取数据出错:\r\n" + ex.Message));
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
return ds;
}
/// <summary>
/// 保存数据表
/// <para>单表效率测试:100行0.75秒;500行3.7秒;5000行36秒左右</para>
/// </summary>
/// <param name="strLink">数据库连接字串</param>
/// <param name="dt">待保存表</param>
/// <returns></returns>
public bool SaveDataTable(string strLink, DataTable dt)
{
SqlConnection conn = null;
SqlTransaction tran = null;
//
string cmdText = $"Select * from {dt.TableName}";
try
{
conn = new SqlConnection(strLink);
conn.Open();
var dataAdapter = new SqlDataAdapter(cmdText, conn);
var commandBuilder = new SqlCommandBuilder(dataAdapter)
{
ConflictOption = ConflictOption.OverwriteChanges,
};
if (dt.PrimaryKey.Length > 0)//没有主键是不能自动生成删除和更新语句的
{
dataAdapter.DeleteCommand = commandBuilder.GetDeleteCommand();
dataAdapter.UpdateCommand = commandBuilder.GetUpdateCommand();
}
dataAdapter.InsertCommand = commandBuilder.GetInsertCommand();
tran = conn.BeginTransaction();//开始事务,并设置回滚点
if (dataAdapter.DeleteCommand != null)//删除和更新有可能为空
dataAdapter.DeleteCommand.Transaction = tran;
if (dataAdapter.UpdateCommand != null)
dataAdapter.UpdateCommand.Transaction = tran;
//
dataAdapter.InsertCommand.Transaction = tran;
dataAdapter.Update(dt);
tran.Commit();
}
catch (Exception ex)
{
if (tran != null)
tran.Rollback();
throw (new Exception("保存数据集出错:\r\n" + ex.Message));
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
return true;
}
/// <summary>
/// 保存数据集
/// <para>单表效率测试:100行0.75秒;500行3.7秒;5000行36秒左右</para>
/// </summary>
/// <param name="strLink">数据库连接字串</param>
/// <param name="ds">待保存的数据集</param>
/// <returns></returns>
public bool SaveData(string strLink, DataSet ds, string strTableName)
{
SqlConnection conn = null;
SqlDataAdapter dataAdapter = null;
SqlCommandBuilder commandBuilder = null;
SqlTransaction tran = null;
//
string cmdText = $"Select * from {strTableName}";
try
{
conn = new SqlConnection(strLink);
conn.Open();
dataAdapter = new SqlDataAdapter(cmdText, conn);
commandBuilder = new SqlCommandBuilder(dataAdapter)
{
ConflictOption = ConflictOption.OverwriteChanges
};
if (ds.Tables[strTableName].PrimaryKey.Length > 0)//没有主键是不能自动生成删除和更新语句的
{
dataAdapter.DeleteCommand = commandBuilder.GetDeleteCommand();
dataAdapter.UpdateCommand = commandBuilder.GetUpdateCommand();
}
dataAdapter.InsertCommand = commandBuilder.GetInsertCommand();
tran = conn.BeginTransaction();//开始事务,并设置回滚点
if (dataAdapter.DeleteCommand != null)//删除和更新有可能为空
dataAdapter.DeleteCommand.Transaction = tran;
if (dataAdapter.UpdateCommand != null)
dataAdapter.UpdateCommand.Transaction = tran;
//
dataAdapter.InsertCommand.Transaction = tran;
dataAdapter.Update(ds, strTableName);
tran.Commit();
}
catch (Exception ex)
{
if (tran != null)
tran.Rollback();
throw (new Exception("保存数据集出错:\r\n" + ex.Message));
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
return true;
}
/// <summary>
/// 保存数据集
/// <para>单表效率测试:100行0.76秒;500行3.7秒;5000行37秒左右</para>
/// </summary>
/// <param name="strLink">数据库连接字串</param>
/// <param name="ds">数据集</param>
/// <param name="Tables">表的扩展集合</param>
/// <returns></returns>
public bool SaveData(string strLink, DataSet ds, List<TQuery> Tables)
{
List<SqlDataAdapter> SqlDAList = new List<SqlDataAdapter>();
//
SqlConnection conn = null;
SqlDataAdapter dataAdapter = null;
SqlCommandBuilder commandBuilder = null;
SqlTransaction tran = null;
string cmdText = string.Empty;
try
{
conn = new SqlConnection(strLink);
conn.Open();
//生成命令
foreach (TQuery t in Tables)
{
cmdText = $"Select * from {t.TableName}";
dataAdapter = new SqlDataAdapter(cmdText, conn);
commandBuilder = new SqlCommandBuilder(dataAdapter)
{
ConflictOption = ConflictOption.OverwriteChanges
};
dataAdapter.DeleteCommand = commandBuilder.GetDeleteCommand();
dataAdapter.InsertCommand = commandBuilder.GetInsertCommand();
dataAdapter.UpdateCommand = commandBuilder.GetUpdateCommand();
SqlDAList.Add(dataAdapter);
}
//开启事务,统一设置事务回滚点
tran = conn.BeginTransaction();
foreach (var a in SqlDAList)
{
a.DeleteCommand.Transaction = tran;
a.UpdateCommand.Transaction = tran;
a.InsertCommand.Transaction = tran;
}
//更新数据
for (int i = 0; i < SqlDAList.Count; i++)
{
var tn = Tables[i].TableName;
SqlDAList[i].Update(ds, tn);
}
//提交事务
tran.Commit();
}
catch (Exception ex)
{
if (tran != null)
tran.Rollback();
throw (new Exception("保存数据集出错:\r\n" + ex.Message));
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
return true;
}
/// <summary>
/// 数据库连接测试
/// </summary>
/// <param name="strLink">数据库连接字串</param>
/// <returns></returns>
public bool ConnectionTest(string strLink)
{
SqlConnection conn = null;
try
{
conn = new SqlConnection(strLink);
conn.Open();
}
catch (Exception)
{
return false;
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
return true;
}
/// <summary>
/// 执行SQL语句:这里的多条语句采用同一事务处理,方便出错时回滚,保证数据统一
/// </summary>
/// <param name="strLink">数据库连接</param>
/// <param name="sqls">带执行的SQL列表</param>
/// <returns></returns>
public bool ExecNonSql(string strLink, params string[] sqls)
{
SqlConnection conn = null;
SqlCommand cmd = null;
SqlTransaction tran = null;
try
{
conn = new SqlConnection(strLink);
conn.Open();
tran = conn.BeginTransaction();//开始事务
cmd = new SqlCommand();
cmd.Connection = conn;//绑定连接
cmd.Transaction = tran;//绑定事务
//批量处理命令
foreach (string cmdText in sqls)
{
cmd.CommandText = cmdText;
cmd.CommandType = CommandType.Text;
int ret = cmd.ExecuteNonQuery();
}
//提交事务
tran.Commit();
}
catch (Exception ex)
{
if (tran != null)
tran.Rollback();
throw (new Exception("执行SQL出错:\r\n" + ex.Message));
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
return true;
}
/// <summary>
/// 是否存在
/// </summary>
/// <param name="strLink"></param>
/// <param name="strSql"></param>
/// <returns></returns>
public bool IsExist(string strLink, string strSql)
{
SqlConnection conn = null;
SqlCommand cmd = null;
object objCount = null;
try
{
conn = new SqlConnection(strLink);
conn.Open();
cmd = new SqlCommand(strSql, conn);
objCount = cmd.ExecuteScalar();
}
catch (Exception ex)
{
throw (new Exception("是否存在执行出错:\r\n" + ex.Message));
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
int iCount = -1;
if (!int.TryParse(objCount.ToString(), out iCount))
{
throw (new Exception("数据类型转换失败!"));
}
return iCount > 0;
}
#region async methods
/*
* 异步方法使用演示:
*
* 1.同步调用:
* ConnectionTestAsync(link).GetAwaiter().GetResult();
* 2.异步调用:
* public async void SomeMethod()
* {
* DataSet ds = await ConnectionTestAsync(link);
* }
* 注意:
* 1、同步调动需通过GetAwaiter().GetResult()等待结果
* 2、异步需使用async修饰,才能在方法内部使用await关键字。
* 使用async修饰的异步方法,必须返回void或Task<T>
*/
/// <summary>
/// 单表取数(异步)
/// </summary>
/// <param name="strLink"></param>
/// <param name="strSql"></param>
/// <param name="strTableName"></param>
/// <returns></returns>
public Task<DataTable> GetDataTableAsync(string strLink, string strSql, string strTableName)
{
return Task.Run(() => GetDataTable(strLink, strSql, strTableName));
}
/// <summary>
/// 单表取数(异步)
/// </summary>
/// <param name="strLink"></param>
/// <param name="strSql"></param>
/// <param name="strTableName"></param>
/// <returns></returns>
public Task<DataSet> GetDataAsync(string strLink, string strSql, string strTableName)
{
return Task.Run(() => GetData(strLink, strSql, strTableName));
}
/// <summary>
/// 多表取数(异步)
/// </summary>
/// <param name="strLink"></param>
/// <param name="Tables"></param>
/// <param name="Schema"></param>
/// <returns></returns>
public Task<DataSet> GetDataAsync(string strLink, List<TQuery> Tables, bool Schema)
{
return Task.Run(() => GetData(strLink, Tables, Schema));
}
/// <summary>
/// 单表保存(异步)
/// </summary>
/// <param name="ds"></param>
/// <param name="strLink"></param>
/// <param name="strTableName"></param>
/// <returns></returns>
public Task<bool> SaveDataTableAsync(string strLink, DataTable dt, string strTableName)
{
return Task.Run(() => SaveDataTable(strLink, dt));
}
/// <summary>
/// 单表保存(异步)
/// </summary>
/// <param name="ds"></param>
/// <param name="strLink"></param>
/// <param name="strTableName"></param>
/// <returns></returns>
public Task<bool> SaveDataAsync(string strLink, DataSet ds, string strTableName)
{
return Task.Run(() => SaveData(strLink, ds, strTableName));
}
/// <summary>
/// 多表保存(异步)
/// </summary>
/// <param name="ds"></param>
/// <param name="strLink"></param>
/// <param name="Tables"></param>
/// <returns></returns>
public Task<bool> SaveDataAsync(string strLink, DataSet ds, List<TQuery> Tables)
{
return Task.Run(() => SaveData(strLink, ds, Tables));
}
/// <summary>
/// 数据库连接测试(异步)
/// </summary>
/// <param name="strLink"></param>
/// <returns></returns>
public Task<bool> ConnectionTestAsync(string strLink)
{
return Task.Run(() => ConnectionTest(strLink));
}
/// <summary>
/// SQL批量执行(异步)
/// </summary>
/// <param name="strLink"></param>
/// <param name="sqls"></param>
/// <returns></returns>
public Task<bool> ExecNonSqlAsync(string strLink, params string[] sqls)
{
return Task.Run(() => ExecNonSql(strLink, sqls));
}
/// <summary>
/// 是否存在(异步)
/// </summary>
/// <param name="strLink"></param>
/// <param name="strSql"></param>
/// <returns></returns>
public Task<bool> ISExistAsync(string strLink, string strSql)
{
return Task.Run(() => IsExist(strLink, strSql));
}
#endregion
}
/// <summary>
/// 表查询
/// </summary>
public class TQuery
{
/// <summary>
/// 构造器
/// </summary>
/// <param name="tableName">数据库表名</param>
public TQuery(string tableName)
{
this.TableName = tableName;
this.QuerySQL = $"SELECT * FROM {tableName}";
}
/// <summary>
/// 构造器
/// </summary>
/// <param name="Name">数据库表名</param>
/// <param name="querySQL">查询语句</param>
public TQuery(string tableName, string querySQL, params SqlParameter[] parameters)
{
this.TableName = tableName;
this.QuerySQL = querySQL;
this.QueryParameters = parameters.ToList();
}
/// <summary>
/// 数据库表名
/// </summary>
public string TableName { get; set; }
/// <summary>
/// Select语句
/// </summary>
public string QuerySQL { get; set; }
/// <summary>
/// 选择语句参数
/// </summary>
public List<SqlParameter> QueryParameters = new List<SqlParameter>();
}
}
using ICSharpCode.SharpZipLib.Zip;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AutoUpdate
{
public class Utils
{
/// <summary>
/// 生成数据库链接字符串
/// </summary>
/// <param name="link"></param>
/// <param name="dbName"></param>
/// <param name="userId"></param>
/// <param name="pwd"></param>
/// <returns></returns>
public static string GetDbLinkString(string link, string userId, string pwd, string dbName)
{
return $"Password={pwd};Persist Security Info=True;User ID={userId};Initial Catalog={dbName};Data Source={link}";
}
/// <summary>
/// Zip:解压文件
/// </summary>
/// <param name="zipFileName">压缩包路径</param>
/// <param name="outFilePath">解压文件路径(缺省时,默认为桌面路径)</param>
public static void ZipDecompress(string zipFileName, string outFilePath = "")
{
if (!File.Exists(zipFileName))
{
MessageBox.Show($"Cannot find file '{zipFileName}'");
return;
}
if (string.IsNullOrEmpty(outFilePath))
{
outFilePath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
}
using ZipInputStream zip = new ZipInputStream(File.OpenRead(zipFileName));
//zip.Password = "123";
byte[] buffer = new byte[1024]; //缓冲区大小
ZipEntry entry;
while ((entry = zip.GetNextEntry()) != null)
{
string directoryName = Path.GetDirectoryName(entry.Name);
string fileName = Path.GetFileName(entry.Name);
if (string.IsNullOrEmpty(directoryName) || string.IsNullOrEmpty(fileName))
continue;
//创建解压文件路径(压缩只考虑相对路径,所以这里创建时要加上输出路径)
Directory.CreateDirectory($@"{outFilePath}\{directoryName}");
using FileStream fs = File.Create($@"{outFilePath}\{entry.Name}"); //entry.Name <=> directoryName + fileName
//写入解压流
int size = 0;
while ((size = zip.Read(buffer, 0, buffer.Length)) > 0)
{
fs.Write(buffer, 0, size);
}
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="SharpZipLib" version="1.3.2" targetFramework="net48" />
</packages>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<!--打包排除文件,半角逗号分隔-->
<add key="ExceptFiles" value="U.Memopad.dll" />
<add key="ExceptFiles" value="U.Memopad.dll"/>
<!--打包时间范围,文件最后修改时间距当前时间多少小时以内-->
<add key="PatchTimeFrame_Dll" value="1" />
<add key="PatchTimeFrame_Sql" value="720" />
<add key="PatchTimeFrame_Xml" value="720" />
<add key="PatchTimeFrame_Dll" value="1"/>
<add key="PatchTimeFrame_Sql" value="720"/>
<add key="PatchTimeFrame_Xml" value="720"/>
<add key="PatchTimeFrame_Xml" value="720" />
<add key="PatchTimeFrame_Xml" value="720"/>
<!--是否排除.pdb文件。1:排除,其他包含。-->
<add key="Exclude_PDB" value="1" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
<add key="Exclude_PDB" value="1"/>
<add key="ClientSettingsProvider.ServiceUri" value=""/>
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri=""/>
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400"/>
</providers>
</roleManager>
</system.web>
......
......@@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType>
<RootNamespace>Ftt.PatchPack</RootNamespace>
<AssemblyName>Ftt.PatchPack</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>false</Deterministic>
<PublishUrl>publish\</PublishUrl>
......@@ -26,6 +26,7 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
......
......@@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ftt.PatchPack", "Ftt.PatchP
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "test\test.csproj", "{1447F8DF-E552-40DD-8F02-B55D75FBC77A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoUpdate", "AutoUpdate\AutoUpdate.csproj", "{ACE4794E-3C69-40DF-88FF-9DA3BC81FEB2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -69,6 +71,18 @@ Global
{1447F8DF-E552-40DD-8F02-B55D75FBC77A}.Release|x64.Build.0 = Release|Any CPU
{1447F8DF-E552-40DD-8F02-B55D75FBC77A}.Release|x86.ActiveCfg = Release|Any CPU
{1447F8DF-E552-40DD-8F02-B55D75FBC77A}.Release|x86.Build.0 = Release|Any CPU
{ACE4794E-3C69-40DF-88FF-9DA3BC81FEB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ACE4794E-3C69-40DF-88FF-9DA3BC81FEB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ACE4794E-3C69-40DF-88FF-9DA3BC81FEB2}.Debug|x64.ActiveCfg = Debug|Any CPU
{ACE4794E-3C69-40DF-88FF-9DA3BC81FEB2}.Debug|x64.Build.0 = Debug|Any CPU
{ACE4794E-3C69-40DF-88FF-9DA3BC81FEB2}.Debug|x86.ActiveCfg = Debug|Any CPU
{ACE4794E-3C69-40DF-88FF-9DA3BC81FEB2}.Debug|x86.Build.0 = Debug|Any CPU
{ACE4794E-3C69-40DF-88FF-9DA3BC81FEB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ACE4794E-3C69-40DF-88FF-9DA3BC81FEB2}.Release|Any CPU.Build.0 = Release|Any CPU
{ACE4794E-3C69-40DF-88FF-9DA3BC81FEB2}.Release|x64.ActiveCfg = Release|Any CPU
{ACE4794E-3C69-40DF-88FF-9DA3BC81FEB2}.Release|x64.Build.0 = Release|Any CPU
{ACE4794E-3C69-40DF-88FF-9DA3BC81FEB2}.Release|x86.ActiveCfg = Release|Any CPU
{ACE4794E-3C69-40DF-88FF-9DA3BC81FEB2}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="ICSharpCode.SharpZipLib" publicKeyToken="1b03e6acf1164f73" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.2.10" newVersion="1.3.2.10" />
<assemblyIdentity name="ICSharpCode.SharpZipLib" publicKeyToken="1b03e6acf1164f73" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.3.2.10" newVersion="1.3.2.10"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
......
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
......@@ -18,5 +20,6 @@ namespace Tools
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new wMain());
}
}
}
......@@ -8,10 +8,11 @@
<OutputType>WinExe</OutputType>
<RootNamespace>Tools</RootNamespace>
<AssemblyName>Tools</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
......
......@@ -197,18 +197,31 @@ namespace Tools
/// </summary>
private void CheckUpdate()
{
var updateTime = MyUtils.Utils.AppSettings("UpdateTime");
var link = MyUtils.Utils.GetDbLinkString("192.168.1.204", "sa", "sa", "FTT_Work");
var dt = new MyData.SmpDB().GetDataTable(link, $"SELECT TOP 1 UDate FROM dbo.FTT_AutoUpdate WHERE UDate > '{updateTime}' ORDER BY UDate DESC", "FTT_AutoUpdate");
if (dt.DefaultView.Count > 0)
{
//记录更新时间
var date = Convert.ToDateTime(dt.DefaultView[0]["UDate"]);
MyUtils.Utils.AppSettings("UpdateTime", date.ToString("yyyy-MM-dd HH:mm:ss.fff"));
//启动自动更新
ProcessStartInfo info = new ProcessStartInfo()
var info = new ProcessStartInfo()
{
FileName = $@".\AutoUpdate\AutoUpdate.exe",
Arguments = $"{Directory.GetParent(MyUtils.Utils.StartupPath)} {Process.GetCurrentProcess().ProcessName}",
UseShellExecute = false,
RedirectStandardError = true,
};
Process up = new Process() { StartInfo = info };
up.Start();
//退出当前应用
//启动更新程序
new Process() { StartInfo = info }.Start();
//退出运行环境
Application.Exit();
GC.Collect();
}
else
{
Utils.Tip("当前已是最新版本!");
}
}
/// <summary>
/// 系统:重新登录
......@@ -232,7 +245,6 @@ namespace Tools
//关闭窗体
this.Close();
}
/// <summary>
/// 账户:密码管理
/// </summary>
......
......@@ -19,7 +19,7 @@ namespace UpdateExecuter.Properties {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
......
......@@ -12,7 +12,7 @@ namespace UpdateExecuter.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.3.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
......
......@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UpdateExecuter</RootNamespace>
<AssemblyName>UpdateExecuter</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
......@@ -165,7 +165,6 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
......
......@@ -12,4 +12,4 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FluentFTP" version="21.0.0" targetFramework="net45" />
<package id="Microsoft.Bcl" version="1.1.8" targetFramework="net40" />
<package id="Microsoft.Bcl" version="1.1.8" targetFramework="net40" requireReinstallation="true" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net40" />
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net40" />
</packages>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
</configuration>
......@@ -47,8 +47,8 @@ namespace test.Properties {
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
......
......@@ -12,7 +12,7 @@ namespace test.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.3.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
......
......@@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType>
<RootNamespace>test</RootNamespace>
<AssemblyName>test</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment