Skip to content

Commit 48ae24f

Browse files
committed
调整目录结构。 🍲
1 parent b1ae046 commit 48ae24f

20 files changed

Lines changed: 24 additions & 24 deletions

upgrading/.shared/Deployer.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static partial class Deployer
4444
/// <summary>表示部署器程序的目录名。</summary>
4545
public static readonly string DIRECTORY = ".deployer";
4646
/// <summary>表示部署器程序的文件名。</summary>
47-
public static readonly string FILENAME = OperatingSystem.IsWindows() ? "deployer.exe" : "deployer";
47+
public static readonly string FILENAME = OperatingSystem.IsWindows() ? $"Zongsoft.Upgrading.Deployer.exe" : "Zongsoft.Upgrading.Deployer";
4848
#endregion
4949

5050
#region 公共属性
@@ -58,15 +58,15 @@ public static partial class Deployer
5858
public static bool HasDeployment() => HasDeployment(out _);
5959
public static bool HasDeployment(out FileInfo file)
6060
{
61-
file = new FileInfo(Path.Combine(Application.ApplicationPath, Configurator.FileName));
61+
file = new FileInfo(Path.Combine(Application.ApplicationPath, Deployment.FileName));
6262

6363
if(file.Exists)
6464
{
65-
using var configurator = Configurator.Load(file.FullName, false);
65+
using var deployment = Deployment.Load(file.FullName, false);
6666

67-
if(configurator != null)
67+
if(deployment != null)
6868
{
69-
var filePath = Path.Combine(configurator.Packages, ".version");
69+
var filePath = Path.Combine(deployment.Packages, ".version");
7070

7171
if(File.Exists(filePath))
7272
{
@@ -85,18 +85,18 @@ public static bool HasDeployment(out FileInfo file)
8585
#endregion
8686

8787
/// <summary>提供部署器相关配置功能的类。</summary>
88-
public sealed class Configurator : IDisposable
88+
public sealed class Deployment : IDisposable
8989
{
9090
#region 常量定义
91-
internal const string FileName = ".deploy";
91+
internal const string FileName = ".deployment";
9292
#endregion
9393

9494
#region 私有变量
9595
private FileStream _stream;
9696
#endregion
9797

9898
#region 私有构造
99-
private Configurator(FileStream stream, string manifest, string packages)
99+
private Deployment(FileStream stream, string manifest, string packages)
100100
{
101101
_stream = stream;
102102
this.Manifest = manifest;
@@ -120,7 +120,7 @@ public void Dispose()
120120
#endregion
121121

122122
#region 静态方法
123-
public static Configurator Load(string path, bool exclusive)
123+
public static Deployment Load(string path, bool exclusive)
124124
{
125125
if(string.IsNullOrEmpty(path) || !File.Exists(path))
126126
return null;
@@ -168,7 +168,7 @@ public static Configurator Load(string path, bool exclusive)
168168
stream.Dispose();
169169
}
170170

171-
return string.IsNullOrEmpty(manifest) || string.IsNullOrEmpty(packages) ? null : new Configurator(exclusive ? stream : null, manifest, packages);
171+
return string.IsNullOrEmpty(manifest) || string.IsNullOrEmpty(packages) ? null : new Deployment(exclusive ? stream : null, manifest, packages);
172172
}
173173

174174
public static string Save(string manifest, string packages, string directory = null)

upgrading/client/Upgrader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static async ValueTask<bool> UpgradeAsync(string channel, CancellationTok
5858
return false;
5959

6060
//创建本次升级的部署文件文件
61-
return Deployer.Configurator.Save(info.FilePath, Path.GetDirectoryName(version)) != null;
61+
return Deployer.Deployment.Save(info.FilePath, Path.GetDirectoryName(version)) != null;
6262
}
6363

6464
public static void Deploy()
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@ public static void Deploy(Argument argument)
4747
return;
4848

4949
//获取部署配置信息并以排他性的锁定部署文件
50-
using var configurator = GetConfigurator(argument);
51-
if(configurator == null)
50+
using var deployment = GetDeployment(argument);
51+
if(deployment == null)
5252
return;
5353

5454
//如果部署包源目录不存在则退出
55-
var packages = new DirectoryInfo(configurator.Packages);
55+
var packages = new DirectoryInfo(deployment.Packages);
5656
if(!packages.Exists)
5757
return;
5858

5959
//如果升级清单加载失败则退出
60-
var manifest = Manifest.Load(configurator.Manifest);
60+
var manifest = Manifest.Load(deployment.Manifest);
6161
if(manifest == null || manifest.IsEmpty)
6262
return;
6363

@@ -77,7 +77,7 @@ public static void Deploy(Argument argument)
7777
#endregion
7878

7979
#region 私有方法
80-
private static Configurator GetConfigurator(Argument argument)
80+
private static Deployment GetDeployment(Argument argument)
8181
{
8282
var deployment = argument.Deployment;
8383

@@ -88,7 +88,7 @@ private static Configurator GetConfigurator(Argument argument)
8888

8989
try
9090
{
91-
return Configurator.Load(deployment, true);
91+
return Deployment.Load(deployment, true);
9292
}
9393
catch(Exception ex)
9494
{
File renamed without changes.

0 commit comments

Comments
 (0)