Skip to content

Commit

Permalink
升级基础组件
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Jul 9, 2024
1 parent a4e47b8 commit 6bc906f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
14 changes: 7 additions & 7 deletions XCoder/CrazyCoder.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,30 +68,30 @@
<ItemGroup>
<PackageReference Include="NewLife.Map" Version="2.5.2024.410-beta1241" />
<PackageReference Include="NewLife.ModbusRTU" Version="1.8.2024.426-beta1011" />
<PackageReference Include="NewLife.Remoting" Version="2.8.2024.426-beta1006" />
<PackageReference Include="NewLife.Remoting" Version="3.0.2024.708" />
<PackageReference Include="System.Speech" Version="8.0.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0" />
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
<PackageReference Include="NewLife.Core">
<Version>10.10.2024.501</Version>
<Version>10.10.2024.701</Version>
</PackageReference>
<PackageReference Include="NewLife.MQTT">
<Version>2.0.2024.407</Version>
<Version>2.0.2024.708</Version>
</PackageReference>
<PackageReference Include="NewLife.Net">
<Version>4.3.2024.408-beta0604</Version>
</PackageReference>
<PackageReference Include="NewLife.Redis">
<Version>5.6.2024.420-beta0005</Version>
<Version>5.7.2024.701</Version>
</PackageReference>
<PackageReference Include="NewLife.Stardust">
<Version>2.9.2024.426-beta1008</Version>
<Version>3.0.2024.708</Version>
</PackageReference>
<PackageReference Include="NewLife.XCode">
<Version>11.12.2024.503</Version>
<Version>11.13.2024.701</Version>
</PackageReference>
<PackageReference Include="SSH.NET">
<Version>2024.0.0</Version>
<Version>2024.1.0</Version>
</PackageReference>
<PackageReference Include="System.IO.Ports" Version="8.0.0" />
<PackageReference Include="System.Management" Version="8.0.0" />
Expand Down
19 changes: 10 additions & 9 deletions XCoder/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using System.Text;
using NewLife;
using NewLife.Log;
using NewLife.Remoting.Clients;
using NewLife.Remoting.Models;
using NewLife.Threading;
using Stardust;
using Stardust.Models;
Expand Down Expand Up @@ -57,17 +59,16 @@ private static void StartClient()
// 登录后保存证书
client.OnLogined += (s, e) =>
{
var inf = client.Info;
if (inf != null && !inf.Code.IsNullOrEmpty())
if (client.Logined && !client.Code.IsNullOrEmpty())
{
set.Code = inf.Code;
set.Secret = inf.Secret;
set.Code = client.Code;
set.Secret = client.Secret;
set.Save();
}
};

// 使用跟踪
client.UseTrace();
//client.UseTrace();

Application.ApplicationExit += (s, e) => client.Logout("ApplicationExit");

Expand Down Expand Up @@ -116,13 +117,13 @@ private static async Task CheckUpgrade(Object data)

// 运行过程中可能改变配置文件的通道
var set = XConfig.Current;
var ug = new Stardust.Web.Upgrade { Log = XTrace.Log };
var ug = new Upgrade { Log = XTrace.Log };

// 去除多余入口文件
ug.Trim("CrazyCoder");

// 检查更新
var ur = await client.Upgrade(set.Channel, _lastVersion);
var ur = await client.Upgrade(set.Channel);
if (ur != null && ur.Version != _lastVersion)
{
client.WriteInfoEvent("Upgrade", $"准备从[{_lastVersion}]更新到[{ur.Version}],开始下载 {ur.Source}");
Expand All @@ -146,11 +147,11 @@ private static async Task CheckUpgrade(Object data)
}
else
{
if (!ur.Preinstall.IsNullOrEmpty())
if (ur is UpgradeInfo ur2 && !ur2.Preinstall.IsNullOrEmpty())
{
client.WriteInfoEvent("Upgrade", "执行预安装脚本");

ug.Run(ur.Preinstall);
ug.Run(ur2.Preinstall);
}

client.WriteInfoEvent("Upgrade", "解压完成,准备覆盖文件");
Expand Down
6 changes: 3 additions & 3 deletions XCoderLinux/XCoderLinux.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@

<ItemGroup>
<PackageReference Include="GtkSharp" Version="3.24.24.95" />
<PackageReference Include="NewLife.Core" Version="10.10.2024.501" />
<PackageReference Include="NewLife.Remoting" Version="2.8.2024.426-beta1006" />
<PackageReference Include="NewLife.XCode" Version="11.12.2024.503" />
<PackageReference Include="NewLife.Core" Version="10.10.2024.701" />
<PackageReference Include="NewLife.Remoting" Version="3.0.2024.708" />
<PackageReference Include="NewLife.XCode" Version="11.13.2024.701" />
<PackageReference Include="System.IO.Ports" Version="8.0.0" />
<PackageReference Include="System.Management" Version="8.0.0" />
</ItemGroup>
Expand Down

0 comments on commit 6bc906f

Please sign in to comment.