Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
chr233 committed Oct 17, 2023
1 parent 0876ba2 commit 3df31f5
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 30 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

env:
PROJECT_NAME: "ASFEnhance"
REPO_NAME: "ASFEnhance"
DOTNET_SDK_VERSION: 7.0.x

jobs:
Expand Down Expand Up @@ -64,22 +65,22 @@ jobs:
- name: Checkout code
uses: actions/[email protected]

- name: Download ASFEnhance-zh-Hans artifact from windows-latest
- name: Download ${{ env.PROJECT_NAME }}-zh-Hans artifact from windows-latest
uses: actions/[email protected]
with:
name: ASFEnhance-zh-Hans.zip
name: ${{ env.PROJECT_NAME }}-zh-Hans.zip
path: out

- name: Download ASFEnhance-en-US artifact from windows-latest
- name: Download ${{ env.PROJECT_NAME }}-en-US artifact from windows-latest
uses: actions/[email protected]
with:
name: ASFEnhance-en-US.zip
name: ${{ env.PROJECT_NAME }}-en-US.zip
path: out

- name: Download ASFEnhance-ru-RU artifact from windows-latest
- name: Download ${{ env.PROJECT_NAME }}-ru-RU artifact from windows-latest
uses: actions/[email protected]
with:
name: ASFEnhance-ru-RU.zip
name: ${{ env.PROJECT_NAME }}-ru-RU.zip
path: out

- name: Create ${{ env.PROJECT_NAME }} GitHub release
Expand All @@ -91,9 +92,8 @@ jobs:
tag: ${{ github.ref_name }}
name: ${{ env.PROJECT_NAME }} ${{ github.ref_name }}
body: |
![ASFEnhance Release](https://img.shields.io/badge/ASFEnhance-${{ github.ref_name }}-brightgreen) ![Downloads](https://img.shields.io/github/downloads/chr233/ASFenhance/${{ github.ref_name }}/total?label=Downloads)
![Release](https://img.shields.io/badge/${{ env.REPO_NAME }}-${{ github.ref_name }}-brightgreen) ![Downloads](https://img.shields.io/github/downloads/chr233/${{ env.REPO_NAME }}/${{ github.ref_name }}/total?label=Downloads)
使用命令 `AU` 自动更新插件
Use command `AU` to update this plugin
---
release created bt github actions
42 changes: 22 additions & 20 deletions ASFEnhance/ASFEnhance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ public Task OnASFInit(IReadOnlyDictionary<string, JToken>? additionalConfigPrope
}
message.AppendLine(Static.Line);

ASFLogger.LogGenericInfo(message.ToString());

PluginConfig? config = null;

if (additionalConfigProperties != null)
Expand All @@ -79,26 +77,36 @@ public Task OnASFInit(IReadOnlyDictionary<string, JToken>? additionalConfigPrope
}
}

var sb = new StringBuilder();
var warnings = new StringBuilder("\n");

Utils.Config = config ?? new();

//开发者特性
if (Config.DevFeature)
{
sb.AppendLine();
sb.AppendLine(Static.Line);
sb.AppendLine(Langs.DevFeatureEnabledWarning);
sb.AppendLine(Static.Line);
warnings.AppendLine(Static.Line);
warnings.AppendLine(Langs.DevFeatureEnabledWarning);
warnings.AppendLine(Static.Line);
}

//使用协议
if (!Config.EULA)
{
sb.AppendLine();
sb.AppendLine(Static.Line);
sb.AppendLineFormat(Langs.EulaWarning, nameof(ASFEnhance));
sb.AppendLine(Static.Line);
warnings.AppendLine(Static.Line);
warnings.AppendLineFormat(Langs.EulaWarning, nameof(ASFEnhance));
warnings.AppendLine(Static.Line);
}

if (warnings.Length > 1)
{
message.Append(warnings);
ASFLogger.LogGenericWarning(message.ToString());
}
else
{
ASFLogger.LogGenericInfo(message.ToString());
}

//地址信息
if (Config.Addresses == null)
{
Expand All @@ -110,10 +118,8 @@ public Task OnASFInit(IReadOnlyDictionary<string, JToken>? additionalConfigPrope
Config.Address = null;
}

if (sb.Length > 0)
{
ASFLogger.LogGenericWarning(sb.ToString());
}


//统计
if (Config.Statistic)
{
Expand All @@ -126,11 +132,7 @@ public Task OnASFInit(IReadOnlyDictionary<string, JToken>? additionalConfigPrope
);
}
//禁用命令
if (Config.DisabledCmds == null)
{
Config.DisabledCmds = new();
}
else
if (Config.DisabledCmds != null)
{
var disabledCmds = new HashSet<string>();
foreach (var cmd in Config.DisabledCmds)
Expand Down
5 changes: 4 additions & 1 deletion ASFEnhance/Data/GitHubReleaseResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

namespace ASFEnhance.Data;

public sealed record GitHubReleaseResponse
/// <summary>
/// GitHub发行版
/// </summary>
internal sealed record GitHubReleaseResponse
{
[JsonProperty(PropertyName = "html_url", Required = Required.Always)]
public string Url { get; set; } = "";
Expand Down

0 comments on commit 3df31f5

Please sign in to comment.