version 0.1.0

Added COPYING and README.md
Implemented Serilog
This commit is contained in:
Jeddunk 2021-01-14 19:38:31 +01:00
parent 32c48b01b9
commit a34ed8881d
11 changed files with 785 additions and 28 deletions

View file

@ -3,6 +3,8 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<FileVersion>0.1.0</FileVersion>
<AssemblyVersion>0.1.0</AssemblyVersion>
<Company>Jeddunk</Company>
</PropertyGroup>
<ItemGroup>

View file

@ -74,12 +74,12 @@ namespace GoldbergGUI.Core.Models
public string Value { get; }
public static AppType Game => new AppType("game");
public static AppType DLC => new AppType("dlc");
public static AppType Music => new AppType("music");
public static AppType Demo => new AppType("demo");
public static AppType Ad => new AppType("advertising");
public static AppType Mod => new AppType("mod");
public static AppType Video => new AppType("video");
public static AppType Game { get; } = new AppType("game");
public static AppType DLC { get; } = new AppType("dlc");
public static AppType Music { get; } = new AppType("music");
public static AppType Demo { get; } = new AppType("demo");
public static AppType Ad { get; } = new AppType("advertising");
public static AppType Mod { get; } = new AppType("mod");
public static AppType Video { get; } = new AppType("video");
}
}

View file

@ -49,11 +49,11 @@ namespace GoldbergGUI.Core.Services
public class SteamService : ISteamService
{
// ReSharper disable StringLiteralTypo
private readonly Dictionary<string, SteamCache> _caches =
new Dictionary<string, SteamCache>
private readonly Dictionary<AppType, SteamCache> _caches =
new Dictionary<AppType, SteamCache>
{
{
AppType.Game.Value,
AppType.Game,
new SteamCache(
"steamapps_games.json",
"https://api.steampowered.com/IStoreService/GetAppList/v1/" +
@ -65,7 +65,7 @@ namespace GoldbergGUI.Core.Services
)
},
{
AppType.DLC.Value,
AppType.DLC,
new SteamCache(
"steamapps_dlc.json",
"https://api.steampowered.com/IStoreService/GetAppList/v1/" +
@ -102,7 +102,7 @@ namespace GoldbergGUI.Core.Services
foreach (var (k, c) in _caches)
{
_log = log;
_log.Info($"Updating cache ({k})...");
_log.Info($"Updating cache ({k.Value})...");
var updateNeeded =
DateTime.Now.Subtract(File.GetLastWriteTimeUtc(c.Filename)).TotalDays >= 1;
SteamApps steamApps;
@ -168,7 +168,7 @@ namespace GoldbergGUI.Core.Services
public IEnumerable<SteamApp> GetListOfAppsByName(string name)
{
var listOfAppsByName = _caches[AppType.Game.Value].Cache.Search(x => x.Name)
var listOfAppsByName = _caches[AppType.Game].Cache.Search(x => x.Name)
.SetCulture(StringComparison.OrdinalIgnoreCase)
.ContainingAll(name.Split(' '));
return listOfAppsByName;
@ -178,7 +178,7 @@ namespace GoldbergGUI.Core.Services
{
_log.Info($"Trying to get app {name}");
var comparableName = Regex.Replace(name, Misc.SpecialCharsRegex, "").ToLower();
var app = _caches[AppType.Game.Value].Cache.FirstOrDefault(x => x.CompareName(comparableName));
var app = _caches[AppType.Game].Cache.FirstOrDefault(x => x.CompareName(comparableName));
if (app != null) _log.Info($"Successfully got app {app}");
return app;
}
@ -186,7 +186,7 @@ namespace GoldbergGUI.Core.Services
public SteamApp GetAppById(int appid)
{
_log.Info($"Trying to get app with ID {appid}");
var app = _caches[AppType.Game.Value].Cache.FirstOrDefault(x => x.AppId.Equals(appid));
var app = _caches[AppType.Game].Cache.FirstOrDefault(x => x.AppId.Equals(appid));
if (app != null) _log.Info($"Successfully got app {app}");
return app;
}
@ -203,7 +203,7 @@ namespace GoldbergGUI.Core.Services
{
steamAppDetails.DLC.ForEach(x =>
{
var result = _caches[AppType.DLC.Value].Cache.FirstOrDefault(y => y.AppId.Equals(x))
var result = _caches[AppType.DLC].Cache.FirstOrDefault(y => y.AppId.Equals(x))
?? new SteamApp {AppId = x, Name = $"Unknown DLC {x}"};
dlcList.Add(result);
});

View file

@ -12,6 +12,7 @@ using System.Windows;
using GoldbergGUI.Core.Models;
using GoldbergGUI.Core.Services;
using Microsoft.Win32;
using MvvmCross;
using MvvmCross.Commands;
using MvvmCross.Logging;
using MvvmCross.Navigation;
@ -20,7 +21,7 @@ using MvvmCross.ViewModels;
namespace GoldbergGUI.Core.ViewModels
{
// ReSharper disable once ClassNeverInstantiated.Global
public class MainViewModel : MvxViewModel
public class MainViewModel : MvxNavigationViewModel
{
private readonly IMvxNavigationService _navigationService;
private string _dllPath;
@ -48,7 +49,7 @@ namespace GoldbergGUI.Core.ViewModels
private readonly IMvxLogProvider _logProvider;
public MainViewModel(ISteamService steam, IGoldbergService goldberg, IMvxLogProvider logProvider,
IMvxNavigationService navigationService)
IMvxNavigationService navigationService) : base(logProvider, navigationService)
{
_steam = steam;
_goldberg = goldberg;