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