Skip to content

Commit 6d78cdf

Browse files
committed
0.5.0版本推送
1 parent 0b4eedd commit 6d78cdf

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

NonsPlayer.Core/Services/AdapterService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class AdapterService
1111
{
1212
#region 事件注册
1313

14-
public delegate void AdapterEventHandler(string param);
14+
public delegate void AdapterEventHandler(string file, Exception? param = null);
1515

1616
public event AdapterEventHandler? AdapterLoadFailed;
1717
public event AdapterEventHandler? AdapterLoading;
@@ -88,12 +88,12 @@ public bool DisableAdapter(AdapterMetadata metadata)
8888
}
8989
}
9090

91-
AdapterLoadFailed?.Invoke(file);
91+
AdapterLoadFailed?.Invoke(file, new Exception("not found any"));
9292
return new Tuple<string?, IAdapter?>(null, null);
9393
}
9494
catch (Exception ex)
9595
{
96-
AdapterLoadFailed?.Invoke(file);
96+
AdapterLoadFailed?.Invoke(file, ex);
9797
return new Tuple<string?, IAdapter?>(null, null);
9898
}
9999
}

NonsPlayer/App.xaml.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public App()
3939
path: ConfigManager.Instance.Settings.Log,
4040
outputTemplate:
4141
"[{Timestamp:HH:mm:ss.fff}] [{Level:u4}] [{SourceContext}]: {Message}{Exception}{NewLine}")
42+
4243
.Enrich.FromLogContext()
4344
.CreateLogger();
4445
Log.Information($"System: {Environment.OSVersion}");
@@ -166,15 +167,15 @@ public App()
166167
GetService<SMTCService>().Init();
167168
}
168169

169-
private void OnAdapterLoading(string param)
170+
private void OnAdapterLoading(string param, Exception? exception)
170171
{
171172
Log.Information("Loading adapter from {path}", param);
172173
}
173174

174-
private void OnAdapterLoadFailed(string name)
175+
private void OnAdapterLoadFailed(string name, Exception? exception)
175176
{
176-
Log.Error($"Failed loading adapter {name}");
177-
ExceptionService.Instance.Throw($"Failed load adapter: {name}");
177+
Log.Error($"Failed loading adapter {name}: {exception}");
178+
ExceptionService.Instance.Throw($"Failed load adapter {name}: {exception}");
178179
}
179180

180181
// The .NET Generic Host provides dependency injection, configuration, logging, and other services.

build.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
$ErrorActionPreference = "Stop";
88

99
if ($Dev) {
10-
dotnet publish NonsPlayer -c Release -r "win10-$Architecture" -o "build/NonsPlayer/app-$Version" -p:Platform=$Architecture -p:DefineConstants=DEV -p:PublishReadyToRun=true -p:PublishTrimmed=true -p:TrimMode=partial -p:Version=$Version -p:UseRidGraph=true;
10+
dotnet publish NonsPlayer -c Release -r "win10-$Architecture" -o "build/NonsPlayer/app-$Version" -p:Platform=$Architecture -p:DefineConstants=DEV -p:PublishReadyToRun=true -p:Version=$Version -p:UseRidGraph=true;
1111
}
1212
else {
13-
dotnet publish NonsPlayer -c Release -r "win10-$Architecture" -o "build/NonsPlayer/app-$Version" -p:Platform=$Architecture -p:PublishReadyToRun=true -p:PublishTrimmed=true -p:TrimMode=partial -p:Version=$Version -p:UseRidGraph=true;
13+
dotnet publish NonsPlayer -c Release -r "win10-$Architecture" -o "build/NonsPlayer/app-$Version" -p:Platform=$Architecture -p:PublishReadyToRun=true -p:Version=$Version -p:UseRidGraph=true;
1414
}
1515

1616
$env:Path += ';C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\';

0 commit comments

Comments
 (0)