Merge pull request 'add more logging' (#40) from waffle.lord/SPT-AKI-Installer:master into master
Reviewed-on: CWX/SPT-AKI-Installer#40
This commit is contained in:
commit
442396e07d
@ -1,4 +1,5 @@
|
|||||||
using Avalonia;
|
using System.Linq;
|
||||||
|
using Avalonia;
|
||||||
using Avalonia.Controls.ApplicationLifetimes;
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
using Avalonia.Markup.Xaml;
|
using Avalonia.Markup.Xaml;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
@ -36,6 +37,12 @@ public partial class App : Application
|
|||||||
{
|
{
|
||||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||||
{
|
{
|
||||||
|
if (desktop.Args != null && desktop.Args.Any(x => x.ToLower() == "debug"))
|
||||||
|
{
|
||||||
|
System.Diagnostics.Trace.Listeners.Add(new SerilogTraceListener.SerilogTraceListener());
|
||||||
|
Log.Debug("TraceListener is registered");
|
||||||
|
}
|
||||||
|
|
||||||
desktop.MainWindow = new MainWindow
|
desktop.MainWindow = new MainWindow
|
||||||
{
|
{
|
||||||
DataContext = new MainWindowViewModel(),
|
DataContext = new MainWindowViewModel(),
|
||||||
|
@ -99,8 +99,13 @@ public class InstallerUpdateInfo : ReactiveObject
|
|||||||
return file.FullName;
|
return file.FullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EndCheck(string infoText, bool updateAvailable)
|
private void EndCheck(string infoText, bool updateAvailable, bool log = true)
|
||||||
{
|
{
|
||||||
|
if (log)
|
||||||
|
{
|
||||||
|
Log.Information(infoText);
|
||||||
|
}
|
||||||
|
|
||||||
UpdateInfoText = infoText;
|
UpdateInfoText = infoText;
|
||||||
|
|
||||||
if (!updateAvailable)
|
if (!updateAvailable)
|
||||||
@ -138,7 +143,7 @@ public class InstallerUpdateInfo : ReactiveObject
|
|||||||
|
|
||||||
if (releases == null || releases.Count == 0)
|
if (releases == null || releases.Count == 0)
|
||||||
{
|
{
|
||||||
EndCheck("No updates available", false);
|
EndCheck("No releases available", false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +151,7 @@ public class InstallerUpdateInfo : ReactiveObject
|
|||||||
|
|
||||||
if (latest == null)
|
if (latest == null)
|
||||||
{
|
{
|
||||||
EndCheck("No updates available", false);
|
EndCheck("could not get latest release", false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +173,7 @@ public class InstallerUpdateInfo : ReactiveObject
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
EndCheck(ex.Message, false);
|
EndCheck(ex.Message, false, false);
|
||||||
Log.Error(ex, "Failed to check for updates");
|
Log.Error(ex, "Failed to check for updates");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ using SPTInstaller.Interfaces;
|
|||||||
using SPTInstaller.Models;
|
using SPTInstaller.Models;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
namespace SPTInstaller;
|
namespace SPTInstaller;
|
||||||
|
|
||||||
@ -19,8 +20,18 @@ internal class Program
|
|||||||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
||||||
// yet and stuff might break.
|
// yet and stuff might break.
|
||||||
[STAThread]
|
[STAThread]
|
||||||
public static void Main(string[] args) => BuildAvaloniaApp()
|
public static void Main(string[] args)
|
||||||
.StartWithClassicDesktopLifetime(args);
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
BuildAvaloniaApp()
|
||||||
|
.StartWithClassicDesktopLifetime(args);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Fatal(ex, "Installer closed unexpectedly");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Avalonia configuration, don't remove; also used by visual designer.
|
// Avalonia configuration, don't remove; also used by visual designer.
|
||||||
public static AppBuilder BuildAvaloniaApp()
|
public static AppBuilder BuildAvaloniaApp()
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
<PackageIcon>icon.ico</PackageIcon>
|
<PackageIcon>icon.ico</PackageIcon>
|
||||||
<ApplicationIcon>Assets\icon.ico</ApplicationIcon>
|
<ApplicationIcon>Assets\icon.ico</ApplicationIcon>
|
||||||
<Configurations>Debug;Release;TEST</Configurations>
|
<Configurations>Debug;Release;TEST</Configurations>
|
||||||
<AssemblyVersion>2.19</AssemblyVersion>
|
<AssemblyVersion>2.20</AssemblyVersion>
|
||||||
<FileVersion>2.19</FileVersion>
|
<FileVersion>2.20</FileVersion>
|
||||||
<Company>SPT-AKI</Company>
|
<Company>SPT-AKI</Company>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
@ -41,6 +41,7 @@
|
|||||||
<PackageReference Include="MegaApiClient" Version="1.10.3" />
|
<PackageReference Include="MegaApiClient" Version="1.10.3" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||||
|
<PackageReference Include="SerilogTraceListener" Version="3.2.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.34.0" />
|
<PackageReference Include="SharpCompress" Version="0.34.0" />
|
||||||
<PackageReference Include="System.Reactive" Version="6.0.0" />
|
<PackageReference Include="System.Reactive" Version="6.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user