Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
1839ec226a | |||
e65d92c12c |
10 changed files with 155 additions and 176 deletions
|
@ -13,6 +13,7 @@ namespace GoldbergGUI.Core
|
||||||
.EndingWith("Service")
|
.EndingWith("Service")
|
||||||
.AsInterfaces()
|
.AsInterfaces()
|
||||||
.RegisterAsLazySingleton();
|
.RegisterAsLazySingleton();
|
||||||
|
//RegisterAppStart<MainViewModel>();
|
||||||
RegisterCustomAppStart<CustomMvxAppStart<MainViewModel>>();
|
RegisterCustomAppStart<CustomMvxAppStart<MainViewModel>>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +1,28 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<FileVersion>0.3.0</FileVersion>
|
<FileVersion>0.3.0</FileVersion>
|
||||||
<Company>Jeddunk</Company>
|
<Company>Jeddunk</Company>
|
||||||
<Platforms>AnyCPU;x86;x64</Platforms>
|
<Platforms>AnyCPU;x86;x64</Platforms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AngleSharp" Version="0.16.1" />
|
<PackageReference Include="AngleSharp" Version="0.14.0" />
|
||||||
<PackageReference Include="MvvmCross" Version="8.0.2" />
|
<PackageReference Include="MvvmCross" Version="7.1.2" />
|
||||||
<PackageReference Include="NinjaNye.SearchExtensions" Version="3.0.1" />
|
<PackageReference Include="NinjaNye.SearchExtensions" Version="3.0.1" />
|
||||||
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
|
<PackageReference Include="SharpCompress" Version="0.35.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.31.0" />
|
<PackageReference Include="sqlite-net-pcl" Version="1.7.335" />
|
||||||
<PackageReference Include="sqlite-net-pcl" Version="1.8.116" />
|
<PackageReference Include="SteamStorefrontAPI" Version="2.0.1.421" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\SteamStorefrontAPI\SteamStorefrontAPI\SteamStorefrontAPI.csproj" />
|
<Reference Include="PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
|
||||||
</ItemGroup>
|
<HintPath>..\..\..\..\..\..\Windows\Microsoft.NET\assembly\GAC_32\PresentationCore\v4.0_4.0.0.0__31bf3856ad364e35\PresentationCore.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<ItemGroup>
|
<Reference Include="PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
|
||||||
<Reference Include="PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
|
<HintPath>..\..\..\..\..\..\Windows\Microsoft.NET\assembly\GAC_MSIL\PresentationFramework\v4.0_4.0.0.0__31bf3856ad364e35\PresentationFramework.dll</HintPath>
|
||||||
<HintPath>..\..\..\..\..\..\Windows\Microsoft.NET\assembly\GAC_32\PresentationCore\v4.0_4.0.0.0__31bf3856ad364e35\PresentationCore.dll</HintPath>
|
</Reference>
|
||||||
</Reference>
|
</ItemGroup>
|
||||||
<Reference Include="PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
|
|
||||||
<HintPath>..\..\..\..\..\..\Windows\Microsoft.NET\assembly\GAC_MSIL\PresentationFramework\v4.0_4.0.0.0__31bf3856ad364e35\PresentationFramework.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using GoldbergGUI.Core.Models;
|
using GoldbergGUI.Core.Models;
|
||||||
using GoldbergGUI.Core.Utils;
|
using GoldbergGUI.Core.Utils;
|
||||||
using Microsoft.Extensions.Logging;
|
using MvvmCross.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -18,7 +18,7 @@ namespace GoldbergGUI.Core.Services
|
||||||
// does file copy stuff
|
// does file copy stuff
|
||||||
public interface IGoldbergService
|
public interface IGoldbergService
|
||||||
{
|
{
|
||||||
public Task<GoldbergGlobalConfiguration> Initialize(ILogger<IGoldbergService> log);
|
public Task<GoldbergGlobalConfiguration> Initialize(IMvxLog log);
|
||||||
public Task<GoldbergConfiguration> Read(string path);
|
public Task<GoldbergConfiguration> Read(string path);
|
||||||
public Task Save(string path, GoldbergConfiguration configuration);
|
public Task Save(string path, GoldbergConfiguration configuration);
|
||||||
public Task<GoldbergGlobalConfiguration> GetGlobalSettings();
|
public Task<GoldbergGlobalConfiguration> GetGlobalSettings();
|
||||||
|
@ -32,7 +32,7 @@ namespace GoldbergGUI.Core.Services
|
||||||
// ReSharper disable once ClassNeverInstantiated.Global
|
// ReSharper disable once ClassNeverInstantiated.Global
|
||||||
public class GoldbergService : IGoldbergService
|
public class GoldbergService : IGoldbergService
|
||||||
{
|
{
|
||||||
private ILogger<IGoldbergService> _log;
|
private IMvxLog _log;
|
||||||
private const string DefaultAccountName = "Mr_Goldberg";
|
private const string DefaultAccountName = "Mr_Goldberg";
|
||||||
private const long DefaultSteamId = 76561197960287930;
|
private const long DefaultSteamId = 76561197960287930;
|
||||||
private const string DefaultLanguage = "english";
|
private const string DefaultLanguage = "english";
|
||||||
|
@ -82,7 +82,7 @@ namespace GoldbergGUI.Core.Services
|
||||||
|
|
||||||
// Call Download
|
// Call Download
|
||||||
// Get global settings
|
// Get global settings
|
||||||
public async Task<GoldbergGlobalConfiguration> Initialize(ILogger<IGoldbergService> log)
|
public async Task<GoldbergGlobalConfiguration> Initialize(IMvxLog log)
|
||||||
{
|
{
|
||||||
_log = log;
|
_log = log;
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ namespace GoldbergGUI.Core.Services
|
||||||
|
|
||||||
public async Task<GoldbergGlobalConfiguration> GetGlobalSettings()
|
public async Task<GoldbergGlobalConfiguration> GetGlobalSettings()
|
||||||
{
|
{
|
||||||
_log.LogInformation("Getting global settings...");
|
_log.Info("Getting global settings...");
|
||||||
var accountName = DefaultAccountName;
|
var accountName = DefaultAccountName;
|
||||||
var steamId = DefaultSteamId;
|
var steamId = DefaultSteamId;
|
||||||
var language = DefaultLanguage;
|
var language = DefaultLanguage;
|
||||||
|
@ -110,7 +110,7 @@ namespace GoldbergGUI.Core.Services
|
||||||
!long.TryParse(File.ReadLines(_userSteamIdPath).First().Trim(), out steamId) &&
|
!long.TryParse(File.ReadLines(_userSteamIdPath).First().Trim(), out steamId) &&
|
||||||
steamId < 76561197960265729 && steamId > 76561202255233023)
|
steamId < 76561197960265729 && steamId > 76561202255233023)
|
||||||
{
|
{
|
||||||
_log.LogError("Invalid User Steam ID! Using default Steam ID...");
|
_log.Error("Invalid User Steam ID! Using default Steam ID...");
|
||||||
steamId = DefaultSteamId;
|
steamId = DefaultSteamId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ namespace GoldbergGUI.Core.Services
|
||||||
customBroadcastIps.AddRange(
|
customBroadcastIps.AddRange(
|
||||||
File.ReadLines(_customBroadcastIpsPath).Select(line => line.Trim()));
|
File.ReadLines(_customBroadcastIpsPath).Select(line => line.Trim()));
|
||||||
}).ConfigureAwait(false);
|
}).ConfigureAwait(false);
|
||||||
_log.LogInformation("Got global settings.");
|
_log.Info("Got global settings.");
|
||||||
return new GoldbergGlobalConfiguration
|
return new GoldbergGlobalConfiguration
|
||||||
{
|
{
|
||||||
AccountName = accountName,
|
AccountName = accountName,
|
||||||
|
@ -135,18 +135,18 @@ namespace GoldbergGUI.Core.Services
|
||||||
var userSteamId = c.UserSteamId;
|
var userSteamId = c.UserSteamId;
|
||||||
var language = c.Language;
|
var language = c.Language;
|
||||||
var customBroadcastIps = c.CustomBroadcastIps;
|
var customBroadcastIps = c.CustomBroadcastIps;
|
||||||
_log.LogInformation("Setting global settings...");
|
_log.Info("Setting global settings...");
|
||||||
// Account Name
|
// Account Name
|
||||||
if (!string.IsNullOrEmpty(accountName))
|
if (!string.IsNullOrEmpty(accountName))
|
||||||
{
|
{
|
||||||
_log.LogInformation("Setting account name...");
|
_log.Info("Setting account name...");
|
||||||
if (!File.Exists(_accountNamePath))
|
if (!File.Exists(_accountNamePath))
|
||||||
await File.Create(_accountNamePath).DisposeAsync().ConfigureAwait(false);
|
await File.Create(_accountNamePath).DisposeAsync().ConfigureAwait(false);
|
||||||
await File.WriteAllTextAsync(_accountNamePath, accountName).ConfigureAwait(false);
|
await File.WriteAllTextAsync(_accountNamePath, accountName).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_log.LogInformation("Invalid account name! Skipping...");
|
_log.Info("Invalid account name! Skipping...");
|
||||||
if (!File.Exists(_accountNamePath))
|
if (!File.Exists(_accountNamePath))
|
||||||
await File.Create(_accountNamePath).DisposeAsync().ConfigureAwait(false);
|
await File.Create(_accountNamePath).DisposeAsync().ConfigureAwait(false);
|
||||||
await File.WriteAllTextAsync(_accountNamePath, DefaultAccountName).ConfigureAwait(false);
|
await File.WriteAllTextAsync(_accountNamePath, DefaultAccountName).ConfigureAwait(false);
|
||||||
|
@ -155,14 +155,14 @@ namespace GoldbergGUI.Core.Services
|
||||||
// User SteamID
|
// User SteamID
|
||||||
if (userSteamId >= 76561197960265729 && userSteamId <= 76561202255233023)
|
if (userSteamId >= 76561197960265729 && userSteamId <= 76561202255233023)
|
||||||
{
|
{
|
||||||
_log.LogInformation("Setting user Steam ID...");
|
_log.Info("Setting user Steam ID...");
|
||||||
if (!File.Exists(_userSteamIdPath))
|
if (!File.Exists(_userSteamIdPath))
|
||||||
await File.Create(_userSteamIdPath).DisposeAsync().ConfigureAwait(false);
|
await File.Create(_userSteamIdPath).DisposeAsync().ConfigureAwait(false);
|
||||||
await File.WriteAllTextAsync(_userSteamIdPath, userSteamId.ToString()).ConfigureAwait(false);
|
await File.WriteAllTextAsync(_userSteamIdPath, userSteamId.ToString()).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_log.LogInformation("Invalid user Steam ID! Skipping...");
|
_log.Info("Invalid user Steam ID! Skipping...");
|
||||||
if (!File.Exists(_userSteamIdPath))
|
if (!File.Exists(_userSteamIdPath))
|
||||||
await File.Create(_userSteamIdPath).DisposeAsync().ConfigureAwait(false);
|
await File.Create(_userSteamIdPath).DisposeAsync().ConfigureAwait(false);
|
||||||
await File.WriteAllTextAsync(_userSteamIdPath, DefaultSteamId.ToString()).ConfigureAwait(false);
|
await File.WriteAllTextAsync(_userSteamIdPath, DefaultSteamId.ToString()).ConfigureAwait(false);
|
||||||
|
@ -171,14 +171,14 @@ namespace GoldbergGUI.Core.Services
|
||||||
// Language
|
// Language
|
||||||
if (!string.IsNullOrEmpty(language))
|
if (!string.IsNullOrEmpty(language))
|
||||||
{
|
{
|
||||||
_log.LogInformation("Setting language...");
|
_log.Info("Setting language...");
|
||||||
if (!File.Exists(_languagePath))
|
if (!File.Exists(_languagePath))
|
||||||
await File.Create(_languagePath).DisposeAsync().ConfigureAwait(false);
|
await File.Create(_languagePath).DisposeAsync().ConfigureAwait(false);
|
||||||
await File.WriteAllTextAsync(_languagePath, language).ConfigureAwait(false);
|
await File.WriteAllTextAsync(_languagePath, language).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_log.LogInformation("Invalid language! Skipping...");
|
_log.Info("Invalid language! Skipping...");
|
||||||
if (!File.Exists(_languagePath))
|
if (!File.Exists(_languagePath))
|
||||||
await File.Create(_languagePath).DisposeAsync().ConfigureAwait(false);
|
await File.Create(_languagePath).DisposeAsync().ConfigureAwait(false);
|
||||||
await File.WriteAllTextAsync(_languagePath, DefaultLanguage).ConfigureAwait(false);
|
await File.WriteAllTextAsync(_languagePath, DefaultLanguage).ConfigureAwait(false);
|
||||||
|
@ -187,7 +187,7 @@ namespace GoldbergGUI.Core.Services
|
||||||
// Custom Broadcast IPs
|
// Custom Broadcast IPs
|
||||||
if (customBroadcastIps != null && customBroadcastIps.Count > 0)
|
if (customBroadcastIps != null && customBroadcastIps.Count > 0)
|
||||||
{
|
{
|
||||||
_log.LogInformation("Setting custom broadcast IPs...");
|
_log.Info("Setting custom broadcast IPs...");
|
||||||
var result =
|
var result =
|
||||||
customBroadcastIps.Aggregate("", (current, address) => $"{current}{address}\n");
|
customBroadcastIps.Aggregate("", (current, address) => $"{current}{address}\n");
|
||||||
if (!File.Exists(_customBroadcastIpsPath))
|
if (!File.Exists(_customBroadcastIpsPath))
|
||||||
|
@ -196,50 +196,50 @@ namespace GoldbergGUI.Core.Services
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_log.LogInformation("Empty list of custom broadcast IPs! Skipping...");
|
_log.Info("Empty list of custom broadcast IPs! Skipping...");
|
||||||
await Task.Run(() => File.Delete(_customBroadcastIpsPath)).ConfigureAwait(false);
|
await Task.Run(() => File.Delete(_customBroadcastIpsPath)).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
_log.LogInformation("Setting global configuration finished.");
|
_log.Info("Setting global configuration finished.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If first time, call GenerateInterfaces
|
// If first time, call GenerateInterfaces
|
||||||
// else try to read config
|
// else try to read config
|
||||||
public async Task<GoldbergConfiguration> Read(string path)
|
public async Task<GoldbergConfiguration> Read(string path)
|
||||||
{
|
{
|
||||||
_log.LogInformation("Reading configuration...");
|
_log.Info("Reading configuration...");
|
||||||
var appId = -1;
|
var appId = -1;
|
||||||
var achievementList = new List<Achievement>();
|
var achievementList = new List<Achievement>();
|
||||||
var dlcList = new List<DlcApp>();
|
var dlcList = new List<DlcApp>();
|
||||||
var steamAppidTxt = Path.Combine(path, "steam_appid.txt");
|
var steamAppidTxt = Path.Combine(path, "steam_appid.txt");
|
||||||
if (File.Exists(steamAppidTxt))
|
if (File.Exists(steamAppidTxt))
|
||||||
{
|
{
|
||||||
_log.LogInformation("Getting AppID...");
|
_log.Info("Getting AppID...");
|
||||||
await Task.Run(() => int.TryParse(File.ReadLines(steamAppidTxt).First().Trim(), out appId))
|
await Task.Run(() => int.TryParse(File.ReadLines(steamAppidTxt).First().Trim(), out appId))
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_log.LogInformation(@"""steam_appid.txt"" missing! Skipping...");
|
_log.Info(@"""steam_appid.txt"" missing! Skipping...");
|
||||||
}
|
}
|
||||||
|
|
||||||
var achievementJson = Path.Combine(path, "steam_settings", "achievements.json");
|
var achievementJson = Path.Combine(path, "steam_settings", "achievements.json");
|
||||||
if (File.Exists(achievementJson))
|
if (File.Exists(achievementJson))
|
||||||
{
|
{
|
||||||
_log.LogInformation("Getting achievements...");
|
_log.Info("Getting achievements...");
|
||||||
var json = await File.ReadAllTextAsync(achievementJson)
|
var json = await File.ReadAllTextAsync(achievementJson)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
achievementList = System.Text.Json.JsonSerializer.Deserialize<List<Achievement>>(json);
|
achievementList = System.Text.Json.JsonSerializer.Deserialize<List<Achievement>>(json);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_log.LogInformation(@"""steam_settings/achievements.json"" missing! Skipping...");
|
_log.Info(@"""steam_settings/achievements.json"" missing! Skipping...");
|
||||||
}
|
}
|
||||||
|
|
||||||
var dlcTxt = Path.Combine(path, "steam_settings", "DLC.txt");
|
var dlcTxt = Path.Combine(path, "steam_settings", "DLC.txt");
|
||||||
var appPathTxt = Path.Combine(path, "steam_settings", "app_paths.txt");
|
var appPathTxt = Path.Combine(path, "steam_settings", "app_paths.txt");
|
||||||
if (File.Exists(dlcTxt))
|
if (File.Exists(dlcTxt))
|
||||||
{
|
{
|
||||||
_log.LogInformation("Getting DLCs...");
|
_log.Info("Getting DLCs...");
|
||||||
var readAllLinesAsync = await File.ReadAllLinesAsync(dlcTxt).ConfigureAwait(false);
|
var readAllLinesAsync = await File.ReadAllLinesAsync(dlcTxt).ConfigureAwait(false);
|
||||||
var expression = new Regex(@"(?<id>.*) *= *(?<name>.*)");
|
var expression = new Regex(@"(?<id>.*) *= *(?<name>.*)");
|
||||||
// ReSharper disable once LoopCanBeConvertedToQuery
|
// ReSharper disable once LoopCanBeConvertedToQuery
|
||||||
|
@ -271,7 +271,7 @@ namespace GoldbergGUI.Core.Services
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_log.LogInformation(@"""steam_settings/DLC.txt"" missing! Skipping...");
|
_log.Info(@"""steam_settings/DLC.txt"" missing! Skipping...");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new GoldbergConfiguration
|
return new GoldbergConfiguration
|
||||||
|
@ -291,9 +291,9 @@ namespace GoldbergGUI.Core.Services
|
||||||
// Save configuration files
|
// Save configuration files
|
||||||
public async Task Save(string path, GoldbergConfiguration c)
|
public async Task Save(string path, GoldbergConfiguration c)
|
||||||
{
|
{
|
||||||
_log.LogInformation("Saving configuration...");
|
_log.Info("Saving configuration...");
|
||||||
// DLL setup
|
// DLL setup
|
||||||
_log.LogInformation("Running DLL setup...");
|
_log.Info("Running DLL setup...");
|
||||||
const string x86Name = "steam_api";
|
const string x86Name = "steam_api";
|
||||||
const string x64Name = "steam_api64";
|
const string x64Name = "steam_api64";
|
||||||
if (File.Exists(Path.Combine(path, $"{x86Name}.dll")))
|
if (File.Exists(Path.Combine(path, $"{x86Name}.dll")))
|
||||||
|
@ -305,10 +305,10 @@ namespace GoldbergGUI.Core.Services
|
||||||
{
|
{
|
||||||
CopyDllFiles(path, x64Name);
|
CopyDllFiles(path, x64Name);
|
||||||
}
|
}
|
||||||
_log.LogInformation("DLL setup finished!");
|
_log.Info("DLL setup finished!");
|
||||||
|
|
||||||
// Create steam_settings folder if missing
|
// Create steam_settings folder if missing
|
||||||
_log.LogInformation("Saving settings...");
|
_log.Info("Saving settings...");
|
||||||
if (!Directory.Exists(Path.Combine(path, "steam_settings")))
|
if (!Directory.Exists(Path.Combine(path, "steam_settings")))
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(Path.Combine(path, "steam_settings"));
|
Directory.CreateDirectory(Path.Combine(path, "steam_settings"));
|
||||||
|
@ -321,21 +321,21 @@ namespace GoldbergGUI.Core.Services
|
||||||
// Achievements + Images
|
// Achievements + Images
|
||||||
if (c.Achievements.Count > 0)
|
if (c.Achievements.Count > 0)
|
||||||
{
|
{
|
||||||
_log.LogInformation("Downloading images...");
|
_log.Info("Downloading images...");
|
||||||
var imagePath = Path.Combine(path, "steam_settings", "images");
|
var imagePath = Path.Combine(path, "steam_settings", "images");
|
||||||
Directory.CreateDirectory(imagePath);
|
Directory.CreateDirectory(imagePath);
|
||||||
|
|
||||||
foreach (var achievement in c.Achievements)
|
foreach (var achievement in c.Achievements)
|
||||||
{
|
{
|
||||||
await DownloadImageAsync(imagePath, achievement.Icon).ConfigureAwait(false);
|
await DownloadImageAsync(imagePath, achievement.Icon);
|
||||||
await DownloadImageAsync(imagePath, achievement.IconGray).ConfigureAwait(false);
|
await DownloadImageAsync(imagePath, achievement.IconGray);
|
||||||
|
|
||||||
// Update achievement list to point to local images instead
|
// Update achievement list to point to local images instead
|
||||||
achievement.Icon = $"images/{Path.GetFileName(achievement.Icon)}";
|
achievement.Icon = $"images/{Path.GetFileName(achievement.Icon)}";
|
||||||
achievement.IconGray = $"images/{Path.GetFileName(achievement.IconGray)}";
|
achievement.IconGray = $"images/{Path.GetFileName(achievement.IconGray)}";
|
||||||
}
|
}
|
||||||
|
|
||||||
_log.LogInformation("Saving achievements...");
|
_log.Info("Saving achievements...");
|
||||||
|
|
||||||
var achievementJson = System.Text.Json.JsonSerializer.Serialize(
|
var achievementJson = System.Text.Json.JsonSerializer.Serialize(
|
||||||
c.Achievements,
|
c.Achievements,
|
||||||
|
@ -347,11 +347,11 @@ namespace GoldbergGUI.Core.Services
|
||||||
await File.WriteAllTextAsync(Path.Combine(path, "steam_settings", "achievements.json"), achievementJson)
|
await File.WriteAllTextAsync(Path.Combine(path, "steam_settings", "achievements.json"), achievementJson)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
_log.LogInformation("Finished saving achievements.");
|
_log.Info("Finished saving achievements.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_log.LogInformation("No achievements set! Removing achievement files...");
|
_log.Info("No achievements set! Removing achievement files...");
|
||||||
var imagePath = Path.Combine(path, "steam_settings", "images");
|
var imagePath = Path.Combine(path, "steam_settings", "images");
|
||||||
if (Directory.Exists(imagePath))
|
if (Directory.Exists(imagePath))
|
||||||
{
|
{
|
||||||
|
@ -362,13 +362,13 @@ namespace GoldbergGUI.Core.Services
|
||||||
{
|
{
|
||||||
File.Delete(achievementPath);
|
File.Delete(achievementPath);
|
||||||
}
|
}
|
||||||
_log.LogInformation("Removed achievement files.");
|
_log.Info("Removed achievement files.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// DLC + App path
|
// DLC + App path
|
||||||
if (c.DlcList.Count > 0)
|
if (c.DlcList.Count > 0)
|
||||||
{
|
{
|
||||||
_log.LogInformation("Saving DLC settings...");
|
_log.Info("Saving DLC settings...");
|
||||||
var dlcContent = "";
|
var dlcContent = "";
|
||||||
//var depotContent = "";
|
//var depotContent = "";
|
||||||
var appPathContent = "";
|
var appPathContent = "";
|
||||||
|
@ -399,54 +399,54 @@ namespace GoldbergGUI.Core.Services
|
||||||
if (File.Exists(Path.Combine(path, "steam_settings", "app_paths.txt")))
|
if (File.Exists(Path.Combine(path, "steam_settings", "app_paths.txt")))
|
||||||
File.Delete(Path.Combine(path, "steam_settings", "app_paths.txt"));
|
File.Delete(Path.Combine(path, "steam_settings", "app_paths.txt"));
|
||||||
}
|
}
|
||||||
_log.LogInformation("Saved DLC settings.");
|
_log.Info("Saved DLC settings.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_log.LogInformation("No DLC set! Removing DLC configuration files...");
|
_log.Info("No DLC set! Removing DLC configuration files...");
|
||||||
if (File.Exists(Path.Combine(path, "steam_settings", "DLC.txt")))
|
if (File.Exists(Path.Combine(path, "steam_settings", "DLC.txt")))
|
||||||
File.Delete(Path.Combine(path, "steam_settings", "DLC.txt"));
|
File.Delete(Path.Combine(path, "steam_settings", "DLC.txt"));
|
||||||
if (File.Exists(Path.Combine(path, "steam_settings", "app_paths.txt")))
|
if (File.Exists(Path.Combine(path, "steam_settings", "app_paths.txt")))
|
||||||
File.Delete(Path.Combine(path, "steam_settings", "app_paths.txt"));
|
File.Delete(Path.Combine(path, "steam_settings", "app_paths.txt"));
|
||||||
_log.LogInformation("Removed DLC configuration files.");
|
_log.Info("Removed DLC configuration files.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Offline
|
// Offline
|
||||||
if (c.Offline)
|
if (c.Offline)
|
||||||
{
|
{
|
||||||
_log.LogInformation("Create offline.txt");
|
_log.Info("Create offline.txt");
|
||||||
await File.Create(Path.Combine(path, "steam_settings", "offline.txt")).DisposeAsync()
|
await File.Create(Path.Combine(path, "steam_settings", "offline.txt")).DisposeAsync()
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_log.LogInformation("Delete offline.txt if it exists");
|
_log.Info("Delete offline.txt if it exists");
|
||||||
File.Delete(Path.Combine(path, "steam_settings", "offline.txt"));
|
File.Delete(Path.Combine(path, "steam_settings", "offline.txt"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable Networking
|
// Disable Networking
|
||||||
if (c.DisableNetworking)
|
if (c.DisableNetworking)
|
||||||
{
|
{
|
||||||
_log.LogInformation("Create disable_networking.txt");
|
_log.Info("Create disable_networking.txt");
|
||||||
await File.Create(Path.Combine(path, "steam_settings", "disable_networking.txt")).DisposeAsync()
|
await File.Create(Path.Combine(path, "steam_settings", "disable_networking.txt")).DisposeAsync()
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_log.LogInformation("Delete disable_networking.txt if it exists");
|
_log.Info("Delete disable_networking.txt if it exists");
|
||||||
File.Delete(Path.Combine(path, "steam_settings", "disable_networking.txt"));
|
File.Delete(Path.Combine(path, "steam_settings", "disable_networking.txt"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable Overlay
|
// Disable Overlay
|
||||||
if (c.DisableOverlay)
|
if (c.DisableOverlay)
|
||||||
{
|
{
|
||||||
_log.LogInformation("Create disable_overlay.txt");
|
_log.Info("Create disable_overlay.txt");
|
||||||
await File.Create(Path.Combine(path, "steam_settings", "disable_overlay.txt")).DisposeAsync()
|
await File.Create(Path.Combine(path, "steam_settings", "disable_overlay.txt")).DisposeAsync()
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_log.LogInformation("Delete disable_overlay.txt if it exists");
|
_log.Info("Delete disable_overlay.txt if it exists");
|
||||||
File.Delete(Path.Combine(path, "steam_settings", "disable_overlay.txt"));
|
File.Delete(Path.Combine(path, "steam_settings", "disable_overlay.txt"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -460,7 +460,7 @@ namespace GoldbergGUI.Core.Services
|
||||||
|
|
||||||
if (!File.Exists(originalDll))
|
if (!File.Exists(originalDll))
|
||||||
{
|
{
|
||||||
_log.LogInformation("Back up original Steam API DLL...");
|
_log.Info("Back up original Steam API DLL...");
|
||||||
File.Move(steamApiDll, originalDll);
|
File.Move(steamApiDll, originalDll);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -469,7 +469,7 @@ namespace GoldbergGUI.Core.Services
|
||||||
File.SetAttributes(guiBackup, FileAttributes.Hidden);
|
File.SetAttributes(guiBackup, FileAttributes.Hidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
_log.LogInformation("Copy Goldberg DLL to target path...");
|
_log.Info("Copy Goldberg DLL to target path...");
|
||||||
File.Copy(goldbergDll, steamApiDll);
|
File.Copy(goldbergDll, steamApiDll);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,7 +477,7 @@ namespace GoldbergGUI.Core.Services
|
||||||
{
|
{
|
||||||
var steamSettingsDirExists = Directory.Exists(Path.Combine(path, "steam_settings"));
|
var steamSettingsDirExists = Directory.Exists(Path.Combine(path, "steam_settings"));
|
||||||
var steamAppIdTxtExists = File.Exists(Path.Combine(path, "steam_appid.txt"));
|
var steamAppIdTxtExists = File.Exists(Path.Combine(path, "steam_appid.txt"));
|
||||||
_log.LogDebug($"Goldberg applied? {steamSettingsDirExists && steamAppIdTxtExists}");
|
_log.Debug($"Goldberg applied? {(steamSettingsDirExists && steamAppIdTxtExists).ToString()}");
|
||||||
return steamSettingsDirExists && steamAppIdTxtExists;
|
return steamSettingsDirExists && steamAppIdTxtExists;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,7 +486,7 @@ namespace GoldbergGUI.Core.Services
|
||||||
// Get webpage
|
// Get webpage
|
||||||
// Get job id, compare with local if exists, save it if false or missing
|
// Get job id, compare with local if exists, save it if false or missing
|
||||||
// Get latest archive if mismatch, call Extract
|
// Get latest archive if mismatch, call Extract
|
||||||
_log.LogInformation("Initializing download...");
|
_log.Info("Initializing download...");
|
||||||
if (!Directory.Exists(_goldbergPath)) Directory.CreateDirectory(_goldbergPath);
|
if (!Directory.Exists(_goldbergPath)) Directory.CreateDirectory(_goldbergPath);
|
||||||
var client = new HttpClient();
|
var client = new HttpClient();
|
||||||
var response = await client.GetAsync(GoldbergUrl).ConfigureAwait(false);
|
var response = await client.GetAsync(GoldbergUrl).ConfigureAwait(false);
|
||||||
|
@ -499,23 +499,23 @@ namespace GoldbergGUI.Core.Services
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_log.LogInformation("Check if update is needed...");
|
_log.Info("Check if update is needed...");
|
||||||
var jobIdLocal = Convert.ToInt32(File.ReadLines(jobIdPath).First().Trim());
|
var jobIdLocal = Convert.ToInt32(File.ReadLines(jobIdPath).First().Trim());
|
||||||
var jobIdRemote = Convert.ToInt32(match.Groups["jobid"].Value);
|
var jobIdRemote = Convert.ToInt32(match.Groups["jobid"].Value);
|
||||||
_log.LogDebug($"job_id: local {jobIdLocal}; remote {jobIdRemote}");
|
_log.Debug($"job_id: local {jobIdLocal}; remote {jobIdRemote}");
|
||||||
if (jobIdLocal.Equals(jobIdRemote))
|
if (jobIdLocal.Equals(jobIdRemote))
|
||||||
{
|
{
|
||||||
_log.LogInformation("Latest Goldberg emulator is already available! Skipping...");
|
_log.Info("Latest Goldberg emulator is already available! Skipping...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
_log.LogError("An error occured, local Goldberg setup might be broken!");
|
_log.Error("An error occured, local Goldberg setup might be broken!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_log.LogInformation("Starting download...");
|
_log.Info("Starting download...");
|
||||||
await StartDownload(match.Value).ConfigureAwait(false);
|
await StartDownload(match.Value).ConfigureAwait(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -525,7 +525,7 @@ namespace GoldbergGUI.Core.Services
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var client = new HttpClient();
|
var client = new HttpClient();
|
||||||
_log.LogDebug(downloadUrl);
|
_log.Debug(downloadUrl);
|
||||||
await using var fileStream = File.OpenWrite(_goldbergZipPath);
|
await using var fileStream = File.OpenWrite(_goldbergZipPath);
|
||||||
//client.GetAsync(downloadUrl, HttpCompletionOption.ResponseHeadersRead)
|
//client.GetAsync(downloadUrl, HttpCompletionOption.ResponseHeadersRead)
|
||||||
var httpRequestMessage = new HttpRequestMessage(HttpMethod.Head, downloadUrl);
|
var httpRequestMessage = new HttpRequestMessage(HttpMethod.Head, downloadUrl);
|
||||||
|
@ -539,7 +539,7 @@ namespace GoldbergGUI.Core.Services
|
||||||
// Environment.Exit(128);
|
// Environment.Exit(128);
|
||||||
if (contentLength == fileLength)
|
if (contentLength == fileLength)
|
||||||
{
|
{
|
||||||
_log.LogInformation("Download finished!");
|
_log.Info("Download finished!");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -550,7 +550,7 @@ namespace GoldbergGUI.Core.Services
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
ShowErrorMessage();
|
ShowErrorMessage();
|
||||||
_log.LogError(e.ToString());
|
_log.Error(e.ToString);
|
||||||
Environment.Exit(1);
|
Environment.Exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -560,7 +560,7 @@ namespace GoldbergGUI.Core.Services
|
||||||
private async Task Extract(string archivePath)
|
private async Task Extract(string archivePath)
|
||||||
{
|
{
|
||||||
var errorOccured = false;
|
var errorOccured = false;
|
||||||
_log.LogDebug("Start extraction...");
|
_log.Debug("Start extraction...");
|
||||||
Directory.Delete(_goldbergPath, true);
|
Directory.Delete(_goldbergPath, true);
|
||||||
Directory.CreateDirectory(_goldbergPath);
|
Directory.CreateDirectory(_goldbergPath);
|
||||||
using (var archive = await Task.Run(() => ZipFile.OpenRead(archivePath)).ConfigureAwait(false))
|
using (var archive = await Task.Run(() => ZipFile.OpenRead(archivePath)).ConfigureAwait(false))
|
||||||
|
@ -584,8 +584,8 @@ namespace GoldbergGUI.Core.Services
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
errorOccured = true;
|
errorOccured = true;
|
||||||
_log.LogError($"Error while trying to extract {entry.FullName}");
|
_log.Error($"Error while trying to extract {entry.FullName}");
|
||||||
_log.LogError(e.ToString());
|
_log.Error(e.ToString);
|
||||||
}
|
}
|
||||||
}).ConfigureAwait(false);
|
}).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
@ -594,9 +594,9 @@ namespace GoldbergGUI.Core.Services
|
||||||
if (errorOccured)
|
if (errorOccured)
|
||||||
{
|
{
|
||||||
ShowErrorMessage();
|
ShowErrorMessage();
|
||||||
_log.LogWarning("Error occured while extraction! Please setup Goldberg manually");
|
_log.Warn("Error occured while extraction! Please setup Goldberg manually");
|
||||||
}
|
}
|
||||||
_log.LogInformation("Extraction was successful!");
|
_log.Info("Extraction was successful!");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowErrorMessage()
|
private void ShowErrorMessage()
|
||||||
|
@ -615,7 +615,7 @@ namespace GoldbergGUI.Core.Services
|
||||||
// (maybe) check DLL date first
|
// (maybe) check DLL date first
|
||||||
public async Task GenerateInterfacesFile(string filePath)
|
public async Task GenerateInterfacesFile(string filePath)
|
||||||
{
|
{
|
||||||
_log.LogDebug($"GenerateInterfacesFile {filePath}");
|
_log.Debug($"GenerateInterfacesFile {filePath}");
|
||||||
//throw new NotImplementedException();
|
//throw new NotImplementedException();
|
||||||
// Get DLL content
|
// Get DLL content
|
||||||
var result = new HashSet<string>();
|
var result = new HashSet<string>();
|
||||||
|
@ -694,11 +694,11 @@ namespace GoldbergGUI.Core.Services
|
||||||
}
|
}
|
||||||
else if (imageUrl.StartsWith("images/"))
|
else if (imageUrl.StartsWith("images/"))
|
||||||
{
|
{
|
||||||
_log.LogWarning($"Previously downloaded image '{imageUrl}' is now missing!");
|
_log.Warn($"Previously downloaded image '{imageUrl}' is now missing!");
|
||||||
}
|
}
|
||||||
|
|
||||||
var wc = new System.Net.WebClient();
|
var wc = new System.Net.WebClient();
|
||||||
await wc.DownloadFileTaskAsync(new Uri(imageUrl, UriKind.Absolute), targetPath).ConfigureAwait(false);
|
await wc.DownloadFileTaskAsync(new Uri(imageUrl, UriKind.Absolute), targetPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@ using AngleSharp.Dom;
|
||||||
using AngleSharp.Html.Parser;
|
using AngleSharp.Html.Parser;
|
||||||
using GoldbergGUI.Core.Models;
|
using GoldbergGUI.Core.Models;
|
||||||
using GoldbergGUI.Core.Utils;
|
using GoldbergGUI.Core.Utils;
|
||||||
using Microsoft.Extensions.Logging;
|
using MvvmCross.Logging;
|
||||||
using NinjaNye.SearchExtensions;
|
using NinjaNye.SearchExtensions;
|
||||||
using SQLite;
|
using SQLite;
|
||||||
using SteamStorefrontAPI;
|
using SteamStorefrontAPI;
|
||||||
|
@ -19,7 +19,7 @@ namespace GoldbergGUI.Core.Services
|
||||||
// gets info from steam api
|
// gets info from steam api
|
||||||
public interface ISteamService
|
public interface ISteamService
|
||||||
{
|
{
|
||||||
public Task Initialize(ILogger<ISteamService> log);
|
public Task Initialize(IMvxLog log);
|
||||||
public Task<IEnumerable<SteamApp>> GetListOfAppsByName(string name);
|
public Task<IEnumerable<SteamApp>> GetListOfAppsByName(string name);
|
||||||
public Task<SteamApp> GetAppByName(string name);
|
public Task<SteamApp> GetAppByName(string name);
|
||||||
public Task<SteamApp> GetAppById(int appid);
|
public Task<SteamApp> GetAppById(int appid);
|
||||||
|
@ -84,11 +84,11 @@ namespace GoldbergGUI.Core.Services
|
||||||
private const string Database = "steamapps.cache";
|
private const string Database = "steamapps.cache";
|
||||||
private const string GameSchemaUrl = "https://api.steampowered.com/ISteamUserStats/GetSchemaForGame/v2/";
|
private const string GameSchemaUrl = "https://api.steampowered.com/ISteamUserStats/GetSchemaForGame/v2/";
|
||||||
|
|
||||||
private ILogger<ISteamService> _log;
|
private IMvxLog _log;
|
||||||
|
|
||||||
private SQLiteAsyncConnection _db;
|
private SQLiteAsyncConnection _db;
|
||||||
|
|
||||||
public async Task Initialize(ILogger<ISteamService> log)
|
public async Task Initialize(IMvxLog log)
|
||||||
{
|
{
|
||||||
static SteamApps DeserializeSteamApps(Type type, string cacheString)
|
static SteamApps DeserializeSteamApps(Type type, string cacheString)
|
||||||
{
|
{
|
||||||
|
@ -101,7 +101,7 @@ namespace GoldbergGUI.Core.Services
|
||||||
_db = new SQLiteAsyncConnection(Database);
|
_db = new SQLiteAsyncConnection(Database);
|
||||||
//_db.CreateTable<SteamApp>();
|
//_db.CreateTable<SteamApp>();
|
||||||
await _db.CreateTableAsync<SteamApp>()
|
await _db.CreateTableAsync<SteamApp>()
|
||||||
//.ContinueWith(x => _log.LogDebug("Table success!"))
|
//.ContinueWith(x => _log.Debug("Table success!"))
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
var countAsync = await _db.Table<SteamApp>().CountAsync().ConfigureAwait(false);
|
var countAsync = await _db.Table<SteamApp>().CountAsync().ConfigureAwait(false);
|
||||||
|
@ -109,7 +109,7 @@ namespace GoldbergGUI.Core.Services
|
||||||
{
|
{
|
||||||
foreach (var (appType, steamCache) in _caches)
|
foreach (var (appType, steamCache) in _caches)
|
||||||
{
|
{
|
||||||
_log.LogInformation($"Updating cache ({appType})...");
|
_log.Info($"Updating cache ({appType})...");
|
||||||
bool haveMoreResults;
|
bool haveMoreResults;
|
||||||
long lastAppId = 0;
|
long lastAppId = 0;
|
||||||
var client = new HttpClient();
|
var client = new HttpClient();
|
||||||
|
@ -152,21 +152,21 @@ namespace GoldbergGUI.Core.Services
|
||||||
|
|
||||||
public async Task<SteamApp> GetAppByName(string name)
|
public async Task<SteamApp> GetAppByName(string name)
|
||||||
{
|
{
|
||||||
_log.LogInformation($"Trying to get app {name}");
|
_log.Info($"Trying to get app {name}");
|
||||||
var comparableName = PrepareStringToCompare(name);
|
var comparableName = PrepareStringToCompare(name);
|
||||||
var app = await _db.Table<SteamApp>()
|
var app = await _db.Table<SteamApp>()
|
||||||
.FirstOrDefaultAsync(x => x.AppType == AppTypeGame && x.ComparableName.Equals(comparableName))
|
.FirstOrDefaultAsync(x => x.AppType == AppTypeGame && x.ComparableName.Equals(comparableName))
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
if (app != null) _log.LogInformation($"Successfully got app {app}");
|
if (app != null) _log.Info($"Successfully got app {app}");
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<SteamApp> GetAppById(int appid)
|
public async Task<SteamApp> GetAppById(int appid)
|
||||||
{
|
{
|
||||||
_log.LogInformation($"Trying to get app with ID {appid}");
|
_log.Info($"Trying to get app with ID {appid}");
|
||||||
var app = await _db.Table<SteamApp>().Where(x => x.AppType == AppTypeGame)
|
var app = await _db.Table<SteamApp>().Where(x => x.AppType == AppTypeGame)
|
||||||
.FirstOrDefaultAsync(x => x.AppId.Equals(appid)).ConfigureAwait(false);
|
.FirstOrDefaultAsync(x => x.AppId.Equals(appid)).ConfigureAwait(false);
|
||||||
if (app != null) _log.LogInformation($"Successfully got app {app}");
|
if (app != null) _log.Info($"Successfully got app {app}");
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,13 +178,13 @@ namespace GoldbergGUI.Core.Services
|
||||||
return achievementList;
|
return achievementList;
|
||||||
}
|
}
|
||||||
|
|
||||||
_log.LogInformation($"Getting achievements for App {steamApp}");
|
_log.Info($"Getting achievements for App {steamApp}");
|
||||||
|
|
||||||
var client = new HttpClient();
|
var client = new HttpClient();
|
||||||
client.DefaultRequestHeaders.UserAgent.ParseAdd(UserAgent);
|
client.DefaultRequestHeaders.UserAgent.ParseAdd(UserAgent);
|
||||||
var apiUrl = $"{GameSchemaUrl}?key={Secrets.SteamWebApiKey()}&appid={steamApp.AppId}&l=en";
|
var apiUrl = $"{GameSchemaUrl}?key={Secrets.SteamWebApiKey()}&appid={steamApp.AppId}&l=en";
|
||||||
|
|
||||||
var response = await client.GetAsync(apiUrl).ConfigureAwait(false);
|
var response = await client.GetAsync(apiUrl);
|
||||||
var responseBody = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
|
var responseBody = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||||||
|
|
||||||
var jsonResponse = JsonDocument.Parse(responseBody);
|
var jsonResponse = JsonDocument.Parse(responseBody);
|
||||||
|
@ -201,7 +201,7 @@ namespace GoldbergGUI.Core.Services
|
||||||
var dlcList = new List<DlcApp>();
|
var dlcList = new List<DlcApp>();
|
||||||
if (steamApp != null)
|
if (steamApp != null)
|
||||||
{
|
{
|
||||||
_log.LogInformation($"Get DLC for App {steamApp}");
|
_log.Info($"Get DLC for App {steamApp}");
|
||||||
var task = AppDetails.GetAsync(steamApp.AppId);
|
var task = AppDetails.GetAsync(steamApp.AppId);
|
||||||
var steamAppDetails = await task.ConfigureAwait(true);
|
var steamAppDetails = await task.ConfigureAwait(true);
|
||||||
if (steamAppDetails.Type == AppTypeGame)
|
if (steamAppDetails.Type == AppTypeGame)
|
||||||
|
@ -212,10 +212,10 @@ namespace GoldbergGUI.Core.Services
|
||||||
.FirstOrDefaultAsync(y => y.AppId.Equals(x)).ConfigureAwait(true)
|
.FirstOrDefaultAsync(y => y.AppId.Equals(x)).ConfigureAwait(true)
|
||||||
?? new SteamApp() { AppId = x, Name = $"Unknown DLC {x}", ComparableName = $"unknownDlc{x}", AppType = AppTypeDlc };
|
?? new SteamApp() { AppId = x, Name = $"Unknown DLC {x}", ComparableName = $"unknownDlc{x}", AppType = AppTypeDlc };
|
||||||
dlcList.Add(new DlcApp(result));
|
dlcList.Add(new DlcApp(result));
|
||||||
_log.LogDebug($"{result.AppId}={result.Name}");
|
_log.Debug($"{result.AppId}={result.Name}");
|
||||||
});
|
});
|
||||||
|
|
||||||
_log.LogInformation("Got DLC successfully...");
|
_log.Info("Got DLC successfully...");
|
||||||
|
|
||||||
// Get DLC from SteamDB
|
// Get DLC from SteamDB
|
||||||
// Get Cloudflare cookie (not implemented)
|
// Get Cloudflare cookie (not implemented)
|
||||||
|
@ -232,15 +232,15 @@ namespace GoldbergGUI.Core.Services
|
||||||
var client = new HttpClient();
|
var client = new HttpClient();
|
||||||
client.DefaultRequestHeaders.UserAgent.ParseAdd(UserAgent);
|
client.DefaultRequestHeaders.UserAgent.ParseAdd(UserAgent);
|
||||||
|
|
||||||
_log.LogInformation($"Get SteamDB App {steamApp}");
|
_log.Info($"Get SteamDB App {steamApp}");
|
||||||
var httpCall = client.GetAsync(steamDbUri);
|
var httpCall = client.GetAsync(steamDbUri);
|
||||||
var response = await httpCall.ConfigureAwait(false);
|
var response = await httpCall.ConfigureAwait(false);
|
||||||
_log.LogDebug(httpCall.Status.ToString());
|
_log.Debug(httpCall.Status.ToString());
|
||||||
_log.LogDebug(response.EnsureSuccessStatusCode().ToString());
|
_log.Debug(response.EnsureSuccessStatusCode().ToString());
|
||||||
|
|
||||||
var readAsStringAsync = response.Content.ReadAsStringAsync();
|
var readAsStringAsync = response.Content.ReadAsStringAsync();
|
||||||
var responseBody = await readAsStringAsync.ConfigureAwait(false);
|
var responseBody = await readAsStringAsync.ConfigureAwait(false);
|
||||||
_log.LogDebug(readAsStringAsync.Status.ToString());
|
_log.Debug(readAsStringAsync.Status.ToString());
|
||||||
|
|
||||||
var parser = new HtmlParser();
|
var parser = new HtmlParser();
|
||||||
var doc = parser.ParseDocument(responseBody);
|
var doc = parser.ParseDocument(responseBody);
|
||||||
|
@ -248,7 +248,7 @@ namespace GoldbergGUI.Core.Services
|
||||||
var query1 = doc.QuerySelector("#dlc");
|
var query1 = doc.QuerySelector("#dlc");
|
||||||
if (query1 != null)
|
if (query1 != null)
|
||||||
{
|
{
|
||||||
_log.LogInformation("Got list of DLC from SteamDB.");
|
_log.Info("Got list of DLC from SteamDB.");
|
||||||
var query2 = query1.QuerySelectorAll(".app");
|
var query2 = query1.QuerySelectorAll(".app");
|
||||||
foreach (var element in query2)
|
foreach (var element in query2)
|
||||||
{
|
{
|
||||||
|
@ -269,28 +269,28 @@ namespace GoldbergGUI.Core.Services
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dlcList.ForEach(x => _log.LogDebug($"{x.AppId}={x.Name}"));
|
dlcList.ForEach(x => _log.Debug($"{x.AppId}={x.Name}"));
|
||||||
_log.LogInformation("Got DLC from SteamDB successfully...");
|
_log.Info("Got DLC from SteamDB successfully...");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_log.LogError("Could not get DLC from SteamDB!");
|
_log.Error("Could not get DLC from SteamDB!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_log.LogError("Could not get DLC from SteamDB! Skipping...");
|
_log.Error("Could not get DLC from SteamDB! Skipping...");
|
||||||
_log.LogError(e.ToString());
|
_log.Error(e.ToString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_log.LogError("Could not get DLC: Steam App is not of type \"game\"");
|
_log.Error("Could not get DLC: Steam App is not of type \"game\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_log.LogError("Could not get DLC: Invalid Steam App");
|
_log.Error("Could not get DLC: Invalid Steam App");
|
||||||
}
|
}
|
||||||
|
|
||||||
return dlcList;
|
return dlcList;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
using GoldbergGUI.Core.Models;
|
using GoldbergGUI.Core.Models;
|
||||||
using GoldbergGUI.Core.Services;
|
using GoldbergGUI.Core.Services;
|
||||||
using GoldbergGUI.Core.Utils;
|
using GoldbergGUI.Core.Utils;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using MvvmCross.Commands;
|
using MvvmCross.Commands;
|
||||||
|
using MvvmCross.Logging;
|
||||||
using MvvmCross.Navigation;
|
using MvvmCross.Navigation;
|
||||||
using MvvmCross.ViewModels;
|
using MvvmCross.ViewModels;
|
||||||
using System;
|
using System;
|
||||||
|
@ -42,20 +42,20 @@ namespace GoldbergGUI.Core.ViewModels
|
||||||
|
|
||||||
private readonly ISteamService _steam;
|
private readonly ISteamService _steam;
|
||||||
private readonly IGoldbergService _goldberg;
|
private readonly IGoldbergService _goldberg;
|
||||||
private readonly ILogger<MainViewModel> _log;
|
private readonly IMvxLog _log;
|
||||||
private bool _mainWindowEnabled;
|
private bool _mainWindowEnabled;
|
||||||
private bool _goldbergApplied;
|
private bool _goldbergApplied;
|
||||||
private ObservableCollection<string> _steamLanguages;
|
private ObservableCollection<string> _steamLanguages;
|
||||||
private string _selectedLanguage;
|
private string _selectedLanguage;
|
||||||
private readonly ILoggerFactory _logProvider;
|
private readonly IMvxLogProvider _logProvider;
|
||||||
|
|
||||||
public MainViewModel(ISteamService steam, IGoldbergService goldberg, ILoggerFactory logProvider,
|
public MainViewModel(ISteamService steam, IGoldbergService goldberg, IMvxLogProvider logProvider,
|
||||||
IMvxNavigationService navigationService) : base(logProvider, navigationService)
|
IMvxNavigationService navigationService) : base(logProvider, navigationService)
|
||||||
{
|
{
|
||||||
_steam = steam;
|
_steam = steam;
|
||||||
_goldberg = goldberg;
|
_goldberg = goldberg;
|
||||||
_logProvider = logProvider;
|
_logProvider = logProvider;
|
||||||
_log = logProvider.CreateLogger<MainViewModel>();
|
_log = logProvider.GetLogFor<MainViewModel>();
|
||||||
_navigationService = navigationService;
|
_navigationService = navigationService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,9 +71,9 @@ namespace GoldbergGUI.Core.ViewModels
|
||||||
{
|
{
|
||||||
SteamLanguages = new ObservableCollection<string>(_goldberg.Languages());
|
SteamLanguages = new ObservableCollection<string>(_goldberg.Languages());
|
||||||
ResetForm();
|
ResetForm();
|
||||||
await _steam.Initialize(_logProvider.CreateLogger<SteamService>()).ConfigureAwait(false);
|
await _steam.Initialize(_logProvider.GetLogFor<SteamService>()).ConfigureAwait(false);
|
||||||
var globalConfiguration =
|
var globalConfiguration =
|
||||||
await _goldberg.Initialize(_logProvider.CreateLogger<GoldbergService>()).ConfigureAwait(false);
|
await _goldberg.Initialize(_logProvider.GetLogFor<GoldbergService>()).ConfigureAwait(false);
|
||||||
AccountName = globalConfiguration.AccountName;
|
AccountName = globalConfiguration.AccountName;
|
||||||
SteamId = globalConfiguration.UserSteamId;
|
SteamId = globalConfiguration.UserSteamId;
|
||||||
SelectedLanguage = globalConfiguration.Language;
|
SelectedLanguage = globalConfiguration.Language;
|
||||||
|
@ -81,7 +81,7 @@ namespace GoldbergGUI.Core.ViewModels
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Console.WriteLine(e);
|
Console.WriteLine(e);
|
||||||
_log.LogError(e.Message);
|
_log.Error(e.Message);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ namespace GoldbergGUI.Core.ViewModels
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var value = !DllPath.Contains("Path to game's steam_api(64).dll");
|
var value = !DllPath.Contains("Path to game's steam_api(64).dll");
|
||||||
if (!value) _log.LogWarning("No DLL selected! Skipping...");
|
if (!value) _log.Warn("No DLL selected! Skipping...");
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -259,7 +259,7 @@ namespace GoldbergGUI.Core.ViewModels
|
||||||
{
|
{
|
||||||
_selectedLanguage = value;
|
_selectedLanguage = value;
|
||||||
RaisePropertyChanged(() => SelectedLanguage);
|
RaisePropertyChanged(() => SelectedLanguage);
|
||||||
//_log.LogDebug($"Lang: {value}");
|
//MyLogger.Log.Debug($"Lang: {value}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,7 +296,7 @@ namespace GoldbergGUI.Core.ViewModels
|
||||||
if (dialog.ShowDialog() != true)
|
if (dialog.ShowDialog() != true)
|
||||||
{
|
{
|
||||||
MainWindowEnabled = true;
|
MainWindowEnabled = true;
|
||||||
_log.LogWarning("File selection canceled.");
|
_log.Warn("File selection canceled.");
|
||||||
StatusText = "No file selected! Ready.";
|
StatusText = "No file selected! Ready.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -326,7 +326,7 @@ namespace GoldbergGUI.Core.ViewModels
|
||||||
|
|
||||||
if (GameName.Contains("Game name..."))
|
if (GameName.Contains("Game name..."))
|
||||||
{
|
{
|
||||||
_log.LogError("No game name entered!");
|
_log.Error("No game name entered!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,7 +371,7 @@ namespace GoldbergGUI.Core.ViewModels
|
||||||
{
|
{
|
||||||
if (AppId <= 0)
|
if (AppId <= 0)
|
||||||
{
|
{
|
||||||
_log.LogError("Invalid Steam App!");
|
_log.Error("Invalid Steam App!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,13 +385,13 @@ namespace GoldbergGUI.Core.ViewModels
|
||||||
{
|
{
|
||||||
if (AppId <= 0)
|
if (AppId <= 0)
|
||||||
{
|
{
|
||||||
_log.LogError("Invalid Steam App!");
|
_log.Error("Invalid Steam App!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindowEnabled = false;
|
MainWindowEnabled = false;
|
||||||
StatusText = "Trying to get list of achievements...";
|
StatusText = "Trying to get list of achievements...";
|
||||||
var listOfAchievements = await _steam.GetListOfAchievements(new SteamApp { AppId = AppId, Name = GameName }).ConfigureAwait(false);
|
var listOfAchievements = await _steam.GetListOfAchievements(new SteamApp { AppId = AppId, Name = GameName });
|
||||||
Achievements = new MvxObservableCollection<Achievement>(listOfAchievements);
|
Achievements = new MvxObservableCollection<Achievement>(listOfAchievements);
|
||||||
MainWindowEnabled = true;
|
MainWindowEnabled = true;
|
||||||
|
|
||||||
|
@ -412,7 +412,7 @@ namespace GoldbergGUI.Core.ViewModels
|
||||||
{
|
{
|
||||||
if (AppId <= 0)
|
if (AppId <= 0)
|
||||||
{
|
{
|
||||||
_log.LogError("Invalid Steam App!");
|
_log.Error("Invalid Steam App!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,7 +437,7 @@ namespace GoldbergGUI.Core.ViewModels
|
||||||
|
|
||||||
private async Task SaveConfig()
|
private async Task SaveConfig()
|
||||||
{
|
{
|
||||||
_log.LogInformation("Saving global settings...");
|
_log.Info("Saving global settings...");
|
||||||
var globalConfiguration = new GoldbergGlobalConfiguration
|
var globalConfiguration = new GoldbergGlobalConfiguration
|
||||||
{
|
{
|
||||||
AccountName = AccountName,
|
AccountName = AccountName,
|
||||||
|
@ -447,7 +447,7 @@ namespace GoldbergGUI.Core.ViewModels
|
||||||
await _goldberg.SetGlobalSettings(globalConfiguration).ConfigureAwait(false);
|
await _goldberg.SetGlobalSettings(globalConfiguration).ConfigureAwait(false);
|
||||||
if (!DllSelected) return;
|
if (!DllSelected) return;
|
||||||
|
|
||||||
_log.LogInformation("Saving Goldberg settings...");
|
_log.Info("Saving Goldberg settings...");
|
||||||
if (!GetDllPathDir(out var dirPath)) return;
|
if (!GetDllPathDir(out var dirPath)) return;
|
||||||
MainWindowEnabled = false;
|
MainWindowEnabled = false;
|
||||||
StatusText = "Saving...";
|
StatusText = "Saving...";
|
||||||
|
@ -476,7 +476,7 @@ namespace GoldbergGUI.Core.ViewModels
|
||||||
SelectedLanguage = globalConfiguration.Language;
|
SelectedLanguage = globalConfiguration.Language;
|
||||||
if (!DllSelected) return;
|
if (!DllSelected) return;
|
||||||
|
|
||||||
_log.LogInformation("Reset form...");
|
_log.Info("Reset form...");
|
||||||
MainWindowEnabled = false;
|
MainWindowEnabled = false;
|
||||||
StatusText = "Resetting...";
|
StatusText = "Resetting...";
|
||||||
await ReadConfig().ConfigureAwait(false);
|
await ReadConfig().ConfigureAwait(false);
|
||||||
|
@ -490,7 +490,7 @@ namespace GoldbergGUI.Core.ViewModels
|
||||||
{
|
{
|
||||||
if (!DllSelected) return;
|
if (!DllSelected) return;
|
||||||
|
|
||||||
_log.LogInformation("Generate steam_interfaces.txt...");
|
_log.Info("Generate steam_interfaces.txt...");
|
||||||
MainWindowEnabled = false;
|
MainWindowEnabled = false;
|
||||||
StatusText = @"Generating ""steam_interfaces.txt"".";
|
StatusText = @"Generating ""steam_interfaces.txt"".";
|
||||||
GetDllPathDir(out var dirPath);
|
GetDllPathDir(out var dirPath);
|
||||||
|
@ -508,10 +508,10 @@ namespace GoldbergGUI.Core.ViewModels
|
||||||
public IMvxCommand PasteDlcCommand => new MvxCommand(() =>
|
public IMvxCommand PasteDlcCommand => new MvxCommand(() =>
|
||||||
{
|
{
|
||||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) return;
|
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) return;
|
||||||
_log.LogInformation("Trying to paste DLC list...");
|
_log.Info("Trying to paste DLC list...");
|
||||||
if (!(Clipboard.ContainsText(TextDataFormat.UnicodeText) || Clipboard.ContainsText(TextDataFormat.Text)))
|
if (!(Clipboard.ContainsText(TextDataFormat.UnicodeText) || Clipboard.ContainsText(TextDataFormat.Text)))
|
||||||
{
|
{
|
||||||
_log.LogWarning("Invalid DLC list!");
|
_log.Warn("Invalid DLC list!");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -604,7 +604,7 @@ namespace GoldbergGUI.Core.ViewModels
|
||||||
dirPath = Path.GetDirectoryName(DllPath);
|
dirPath = Path.GetDirectoryName(DllPath);
|
||||||
if (dirPath != null) return true;
|
if (dirPath != null) return true;
|
||||||
|
|
||||||
_log.LogError($"Invalid directory for {DllPath}.");
|
_log.Error($"Invalid directory for {DllPath}.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using GoldbergGUI.Core.Models;
|
using GoldbergGUI.Core.Models;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using MvvmCross.Commands;
|
using MvvmCross.Commands;
|
||||||
|
using MvvmCross.Logging;
|
||||||
using MvvmCross.Navigation;
|
using MvvmCross.Navigation;
|
||||||
using MvvmCross.ViewModels;
|
using MvvmCross.ViewModels;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
@ -11,13 +11,13 @@ namespace GoldbergGUI.Core.ViewModels
|
||||||
public class SearchResultViewModel : MvxNavigationViewModel<IEnumerable<SteamApp>>, IMvxViewModel<IEnumerable<SteamApp>, SteamApp>
|
public class SearchResultViewModel : MvxNavigationViewModel<IEnumerable<SteamApp>>, IMvxViewModel<IEnumerable<SteamApp>, SteamApp>
|
||||||
{
|
{
|
||||||
private readonly IMvxNavigationService _navigationService;
|
private readonly IMvxNavigationService _navigationService;
|
||||||
private readonly ILogger<SearchResultViewModel> _log;
|
private readonly IMvxLog _log;
|
||||||
private IEnumerable<SteamApp> _apps;
|
private IEnumerable<SteamApp> _apps;
|
||||||
|
|
||||||
public SearchResultViewModel(ILoggerFactory logProvider, IMvxNavigationService navigationService) :
|
public SearchResultViewModel(IMvxLogProvider logProvider, IMvxNavigationService navigationService) :
|
||||||
base(logProvider, navigationService)
|
base(logProvider, navigationService)
|
||||||
{
|
{
|
||||||
_log = logProvider.CreateLogger<SearchResultViewModel>();//.GetLogFor(typeof(SearchResultViewModel));
|
_log = logProvider.GetLogFor(typeof(SearchResultViewModel));
|
||||||
_navigationService = navigationService;
|
_navigationService = navigationService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ namespace GoldbergGUI.Core.ViewModels
|
||||||
{
|
{
|
||||||
if (Selected != null)
|
if (Selected != null)
|
||||||
{
|
{
|
||||||
_log.LogInformation($"Successfully got app {Selected}");
|
_log.Info($"Successfully got app {Selected}");
|
||||||
await _navigationService.Close(this, Selected).ConfigureAwait(false);
|
await _navigationService.Close(this, Selected).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,18 +2,18 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net6.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
|
<FileVersion>0.3.0</FileVersion>
|
||||||
<Company>Jeddunk</Company>
|
<Company>Jeddunk</Company>
|
||||||
<Platforms>x86</Platforms>
|
<Platforms>AnyCPU;x86;x64</Platforms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="MvvmCross.Platforms.Wpf" Version="8.0.2" />
|
<PackageReference Include="MvvmCross.Platforms.Wpf" Version="7.1.2" />
|
||||||
<PackageReference Include="Serilog" Version="2.11.0" />
|
<PackageReference Include="Serilog" Version="2.10.0" />
|
||||||
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
|
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -1,18 +1,15 @@
|
||||||
using Microsoft.Extensions.Logging;
|
using MvvmCross.Logging;
|
||||||
using MvvmCross.Platforms.Wpf.Core;
|
using MvvmCross.Platforms.Wpf.Core;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using Serilog.Extensions.Logging;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace GoldbergGUI.WPF
|
namespace GoldbergGUI.WPF
|
||||||
{
|
{
|
||||||
public class Setup : MvxWpfSetup<Core.App>
|
public class Setup : MvxWpfSetup<Core.App>
|
||||||
{
|
{
|
||||||
protected override ILoggerProvider CreateLogProvider()
|
public override MvxLogProviderType GetDefaultLogProviderType() => MvxLogProviderType.Serilog;
|
||||||
{
|
|
||||||
return new SerilogLoggerProvider();
|
protected override IMvxLogProvider CreateLogProvider()
|
||||||
}
|
|
||||||
protected override ILoggerFactory CreateLogFactory()
|
|
||||||
{
|
{
|
||||||
var logPath = Path.Combine(Directory.GetCurrentDirectory(), "goldberg_.log");
|
var logPath = Path.Combine(Directory.GetCurrentDirectory(), "goldberg_.log");
|
||||||
Log.Logger = new LoggerConfiguration()
|
Log.Logger = new LoggerConfiguration()
|
||||||
|
@ -20,7 +17,7 @@ namespace GoldbergGUI.WPF
|
||||||
.WriteTo.Console()
|
.WriteTo.Console()
|
||||||
.WriteTo.File(logPath, rollingInterval: RollingInterval.Day)
|
.WriteTo.File(logPath, rollingInterval: RollingInterval.Day)
|
||||||
.CreateLogger();
|
.CreateLogger();
|
||||||
return new SerilogLoggerFactory();
|
return base.CreateLogProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GoldbergGUI.Core", "Goldber
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GoldbergGUI.WPF", "GoldbergGUI.WPF\GoldbergGUI.WPF.csproj", "{84ED15D3-725C-43B1-B8C7-51759CAABBAA}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GoldbergGUI.WPF", "GoldbergGUI.WPF\GoldbergGUI.WPF.csproj", "{84ED15D3-725C-43B1-B8C7-51759CAABBAA}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SteamStorefrontAPI", "SteamStorefrontAPI\SteamStorefrontAPI\SteamStorefrontAPI.csproj", "{42D17FA4-C45C-4CC1-BA9C-80B3FA1C006D}"
|
|
||||||
EndProject
|
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4E7DA860-D7FD-4090-B7EC-6DA3974DC845}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4E7DA860-D7FD-4090-B7EC-6DA3974DC845}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
COPYING = COPYING
|
COPYING = COPYING
|
||||||
|
@ -49,18 +47,6 @@ Global
|
||||||
{84ED15D3-725C-43B1-B8C7-51759CAABBAA}.Release|x64.Build.0 = Release|Any CPU
|
{84ED15D3-725C-43B1-B8C7-51759CAABBAA}.Release|x64.Build.0 = Release|Any CPU
|
||||||
{84ED15D3-725C-43B1-B8C7-51759CAABBAA}.Release|x86.ActiveCfg = Release|x86
|
{84ED15D3-725C-43B1-B8C7-51759CAABBAA}.Release|x86.ActiveCfg = Release|x86
|
||||||
{84ED15D3-725C-43B1-B8C7-51759CAABBAA}.Release|x86.Build.0 = Release|x86
|
{84ED15D3-725C-43B1-B8C7-51759CAABBAA}.Release|x86.Build.0 = Release|x86
|
||||||
{42D17FA4-C45C-4CC1-BA9C-80B3FA1C006D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{42D17FA4-C45C-4CC1-BA9C-80B3FA1C006D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{42D17FA4-C45C-4CC1-BA9C-80B3FA1C006D}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{42D17FA4-C45C-4CC1-BA9C-80B3FA1C006D}.Debug|x64.Build.0 = Debug|Any CPU
|
|
||||||
{42D17FA4-C45C-4CC1-BA9C-80B3FA1C006D}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{42D17FA4-C45C-4CC1-BA9C-80B3FA1C006D}.Debug|x86.Build.0 = Debug|Any CPU
|
|
||||||
{42D17FA4-C45C-4CC1-BA9C-80B3FA1C006D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{42D17FA4-C45C-4CC1-BA9C-80B3FA1C006D}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{42D17FA4-C45C-4CC1-BA9C-80B3FA1C006D}.Release|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{42D17FA4-C45C-4CC1-BA9C-80B3FA1C006D}.Release|x64.Build.0 = Release|Any CPU
|
|
||||||
{42D17FA4-C45C-4CC1-BA9C-80B3FA1C006D}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{42D17FA4-C45C-4CC1-BA9C-80B3FA1C006D}.Release|x86.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 45608312c692631476c3244e7e6560dd2935f895
|
|
Loading…
Add table
Add a link
Reference in a new issue