Compare commits
No commits in common. "5e2833e068413727d3a82ff8e196b7bb25db4eec" and "23459ec79463afe81675702aa4656ad354d668cd" have entirely different histories.
5e2833e068
...
23459ec794
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +0,0 @@
|
|||||||
[submodule "SteamStorefrontAPI"]
|
|
||||||
path = SteamStorefrontAPI
|
|
||||||
url = https://git.jeddunk.xyz/jeddunk/SteamStorefrontAPI.git
|
|
@ -1 +0,0 @@
|
|||||||
Subproject commit 45608312c692631476c3244e7e6560dd2935f895
|
|
@ -1,12 +1,10 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 17
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 17.8.34330.188
|
VisualStudioVersion = 16.0.30413.136
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "auto-creamapi", "auto-creamapi\auto-creamapi.csproj", "{26060B32-199E-4366-8FDE-6B1E10E0EF62}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "auto-creamapi", "auto-creamapi\auto-creamapi.csproj", "{26060B32-199E-4366-8FDE-6B1E10E0EF62}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SteamStorefrontAPI", "SteamStorefrontAPI\SteamStorefrontAPI\SteamStorefrontAPI.csproj", "{ECDB602D-4823-4F8E-8BAA-9554A08FA90F}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -17,10 +15,6 @@ Global
|
|||||||
{26060B32-199E-4366-8FDE-6B1E10E0EF62}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{26060B32-199E-4366-8FDE-6B1E10E0EF62}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{26060B32-199E-4366-8FDE-6B1E10E0EF62}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{26060B32-199E-4366-8FDE-6B1E10E0EF62}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{26060B32-199E-4366-8FDE-6B1E10E0EF62}.Release|Any CPU.Build.0 = Release|Any CPU
|
{26060B32-199E-4366-8FDE-6B1E10E0EF62}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{ECDB602D-4823-4F8E-8BAA-9554A08FA90F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{ECDB602D-4823-4F8E-8BAA-9554A08FA90F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{ECDB602D-4823-4F8E-8BAA-9554A08FA90F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{ECDB602D-4823-4F8E-8BAA-9554A08FA90F}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -10,7 +10,7 @@ namespace auto_creamapi
|
|||||||
{
|
{
|
||||||
protected override void RegisterSetup()
|
protected override void RegisterSetup()
|
||||||
{
|
{
|
||||||
this.RegisterSetupType<Setup>();
|
this.RegisterSetupType<MvxWpfSetup<Core.App>>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -31,26 +31,24 @@ namespace auto_creamapi.Converters
|
|||||||
{
|
{
|
||||||
MyLogger.Log.Debug("ListOfDLcToStringConverter: ConvertBack");
|
MyLogger.Log.Debug("ListOfDLcToStringConverter: ConvertBack");
|
||||||
var stringToDlcList = StringToDlcList(value);
|
var stringToDlcList = StringToDlcList(value);
|
||||||
return stringToDlcList.GetType() == targetType ? stringToDlcList : [];
|
return stringToDlcList.GetType() == targetType ? stringToDlcList : new ObservableCollection<SteamApp>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ObservableCollection<SteamApp> StringToDlcList(string value)
|
private static ObservableCollection<SteamApp> StringToDlcList(string value)
|
||||||
{
|
{
|
||||||
var result = new ObservableCollection<SteamApp>();
|
var result = new ObservableCollection<SteamApp>();
|
||||||
var expression = new Regex("(?<id>.*) *= *(?<name>.*)");
|
var expression = new Regex(@"(?<id>.*) *= *(?<name>.*)");
|
||||||
using var reader = new StringReader(value);
|
using var reader = new StringReader(value);
|
||||||
string line;
|
string line;
|
||||||
while ((line = reader.ReadLine()) != null)
|
while ((line = reader.ReadLine()) != null)
|
||||||
{
|
{
|
||||||
var match = expression.Match(line);
|
var match = expression.Match(line);
|
||||||
if (match.Success)
|
if (match.Success)
|
||||||
{
|
|
||||||
result.Add(new SteamApp
|
result.Add(new SteamApp
|
||||||
{
|
{
|
||||||
AppId = int.Parse(match.Groups["id"].Value),
|
AppId = int.Parse(match.Groups["id"].Value),
|
||||||
Name = match.Groups["name"].Value
|
Name = match.Groups["name"].Value
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -4,7 +4,7 @@ using MvvmCross.ViewModels;
|
|||||||
|
|
||||||
namespace auto_creamapi.Core
|
namespace auto_creamapi.Core
|
||||||
{
|
{
|
||||||
public class MainApplication : MvxApplication
|
public class App : MvxApplication
|
||||||
{
|
{
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
@ -33,7 +33,11 @@ namespace auto_creamapi.Services
|
|||||||
private const string CachePath = "steamapps.json";
|
private const string CachePath = "steamapps.json";
|
||||||
private const string SteamUri = "https://api.steampowered.com/ISteamApps/GetAppList/v2/";
|
private const string SteamUri = "https://api.steampowered.com/ISteamApps/GetAppList/v2/";
|
||||||
|
|
||||||
private HashSet<SteamApp> _cache = [];
|
private const string UserAgent =
|
||||||
|
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " +
|
||||||
|
"Chrome/87.0.4280.88 Safari/537.36";
|
||||||
|
|
||||||
|
private HashSet<SteamApp> _cache = new HashSet<SteamApp>();
|
||||||
|
|
||||||
public async Task Initialize()
|
public async Task Initialize()
|
||||||
{
|
{
|
||||||
@ -109,7 +113,7 @@ namespace auto_creamapi.Services
|
|||||||
{
|
{
|
||||||
MyLogger.Log.Debug("Type for Steam App {Name}: \"{Type}\"", steamApp.Name,
|
MyLogger.Log.Debug("Type for Steam App {Name}: \"{Type}\"", steamApp.Name,
|
||||||
steamAppDetails.Type);
|
steamAppDetails.Type);
|
||||||
if (steamAppDetails.Type == "game" || steamAppDetails.Type == "demo")
|
if (steamAppDetails.Type == "game" | steamAppDetails.Type == "demo")
|
||||||
{
|
{
|
||||||
steamAppDetails.DLC.ForEach(x =>
|
steamAppDetails.DLC.ForEach(x =>
|
||||||
{
|
{
|
||||||
@ -117,44 +121,29 @@ namespace auto_creamapi.Services
|
|||||||
if (result == null) return;
|
if (result == null) return;
|
||||||
var dlcDetails = AppDetails.GetAsync(x).Result;
|
var dlcDetails = AppDetails.GetAsync(x).Result;
|
||||||
dlcList.Add(dlcDetails != null
|
dlcList.Add(dlcDetails != null
|
||||||
? new SteamApp { AppId = dlcDetails.SteamAppId, Name = dlcDetails.Name }
|
? new SteamApp {AppId = dlcDetails.SteamAppId, Name = dlcDetails.Name}
|
||||||
: new SteamApp { AppId = x, Name = $"Unknown DLC {x}" });
|
: new SteamApp {AppId = x, Name = $"Unknown DLC {x}"});
|
||||||
});
|
});
|
||||||
|
|
||||||
dlcList.ForEach(x => MyLogger.Log.Debug("{AppId}={Name}", x.AppId, x.Name));
|
dlcList.ForEach(x => MyLogger.Log.Debug("{AppId}={Name}", x.AppId, x.Name));
|
||||||
MyLogger.Log.Information("Got DLC successfully...");
|
MyLogger.Log.Information("Got DLC successfully...");
|
||||||
|
|
||||||
// Return if Steam DB is deactivated
|
|
||||||
if (!useSteamDb) return dlcList;
|
if (!useSteamDb) return dlcList;
|
||||||
|
|
||||||
string steamDbUrl = $"https://steamdb.info/app/{steamApp.AppId}/dlc/";
|
// Get DLC from SteamDB
|
||||||
|
// Get Cloudflare cookie
|
||||||
|
// Scrape and parse HTML page
|
||||||
|
// Add missing to DLC list
|
||||||
|
var steamDbUri = new Uri($"https://steamdb.info/app/{steamApp.AppId}/dlc/");
|
||||||
|
|
||||||
var client = new HttpClient();
|
var client = new HttpClient();
|
||||||
string archiveJson = await client.GetStringAsync($"https://archive.org/wayback/available?url={steamDbUrl}");
|
client.DefaultRequestHeaders.UserAgent.ParseAdd(UserAgent);
|
||||||
var archiveResult = JsonSerializer.Deserialize<AvailableArchive>(archiveJson);
|
|
||||||
|
|
||||||
if (archiveResult == null || archiveResult.ArchivedSnapshots.Closest.Status != "200")
|
|
||||||
{
|
|
||||||
return dlcList;
|
|
||||||
}
|
|
||||||
|
|
||||||
//language=regex
|
|
||||||
const string pattern = @"^(https?:\/\/web\.archive\.org\/web\/\d+)(\/.+)$";
|
|
||||||
const string substitution = "$1id_$2";
|
|
||||||
const RegexOptions options = RegexOptions.Multiline;
|
|
||||||
|
|
||||||
Regex regex = new(pattern, options);
|
|
||||||
string newUrl = regex.Replace(archiveResult.ArchivedSnapshots.Closest.Url, substitution);
|
|
||||||
|
|
||||||
//client.DefaultRequestHeaders.UserAgent.ParseAdd(UserAgent);
|
|
||||||
|
|
||||||
MyLogger.Log.Information("Get SteamDB App");
|
MyLogger.Log.Information("Get SteamDB App");
|
||||||
var httpCall = client.GetAsync(newUrl);
|
var httpCall = client.GetAsync(steamDbUri);
|
||||||
var response = await httpCall.ConfigureAwait(false);
|
var response = await httpCall.ConfigureAwait(false);
|
||||||
MyLogger.Log.Debug("{Status}", httpCall.Status.ToString());
|
MyLogger.Log.Debug("{Status}", httpCall.Status.ToString());
|
||||||
MyLogger.Log.Debug("{Boolean}", response.IsSuccessStatusCode.ToString());
|
MyLogger.Log.Debug("{Boolean}", response.EnsureSuccessStatusCode().ToString());
|
||||||
|
|
||||||
response.EnsureSuccessStatusCode();
|
|
||||||
|
|
||||||
var readAsStringAsync = response.Content.ReadAsStringAsync();
|
var readAsStringAsync = response.Content.ReadAsStringAsync();
|
||||||
var responseBody = await readAsStringAsync.ConfigureAwait(false);
|
var responseBody = await readAsStringAsync.ConfigureAwait(false);
|
||||||
@ -182,7 +171,7 @@ namespace auto_creamapi.Services
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var dlcApp = new SteamApp { AppId = Convert.ToInt32(dlcId), Name = dlcName };
|
var dlcApp = new SteamApp {AppId = Convert.ToInt32(dlcId), Name = dlcName};
|
||||||
var i = dlcList.FindIndex(x => x.AppId.Equals(dlcApp.AppId));
|
var i = dlcList.FindIndex(x => x.AppId.Equals(dlcApp.AppId));
|
||||||
if (i > -1)
|
if (i > -1)
|
||||||
{
|
{
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
using auto_creamapi.Core;
|
|
||||||
using auto_creamapi.Utils;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using MvvmCross.Platforms.Wpf.Core;
|
|
||||||
using Serilog;
|
|
||||||
using Serilog.Extensions.Logging;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace auto_creamapi
|
|
||||||
{
|
|
||||||
public class Setup : MvxWpfSetup<MainApplication>
|
|
||||||
{
|
|
||||||
protected override ILoggerFactory CreateLogFactory()
|
|
||||||
{
|
|
||||||
Log.Logger = MyLogger.Log;
|
|
||||||
|
|
||||||
return new SerilogLoggerFactory();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override ILoggerProvider CreateLogProvider()
|
|
||||||
{
|
|
||||||
return new SerilogLoggerProvider();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace auto_creamapi.Utils
|
|
||||||
{
|
|
||||||
|
|
||||||
public class AvailableArchive
|
|
||||||
{
|
|
||||||
[JsonPropertyName("url")]
|
|
||||||
public string Url { get; set; }
|
|
||||||
|
|
||||||
[JsonPropertyName("archived_snapshots")]
|
|
||||||
public ArchivedSnapshot ArchivedSnapshots { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ArchivedSnapshot
|
|
||||||
{
|
|
||||||
[JsonPropertyName("closest")]
|
|
||||||
public Closest Closest { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Closest
|
|
||||||
{
|
|
||||||
[JsonPropertyName("status")]
|
|
||||||
public string Status { get; set; }
|
|
||||||
|
|
||||||
[JsonPropertyName("available")]
|
|
||||||
public bool Available { get; set; }
|
|
||||||
|
|
||||||
[JsonPropertyName("url")]
|
|
||||||
public string Url { get; set; }
|
|
||||||
|
|
||||||
[JsonPropertyName("timestamp")]
|
|
||||||
public string Timestamp { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
namespace auto_creamapi.Utils
|
|
||||||
{
|
|
||||||
public interface ISecrets
|
|
||||||
{
|
|
||||||
public string ForumUsername();
|
|
||||||
public string ForumPassword();
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,11 +3,11 @@ using System.Collections.ObjectModel;
|
|||||||
|
|
||||||
namespace auto_creamapi.Utils
|
namespace auto_creamapi.Utils
|
||||||
{
|
{
|
||||||
public static class Misc
|
public class Misc
|
||||||
{
|
{
|
||||||
public const string SpecialCharsRegex = "[^0-9a-zA-Z]+";
|
public const string SpecialCharsRegex = "[^0-9a-zA-Z]+";
|
||||||
public const string DefaultLanguageSelection = "english";
|
public const string DefaultLanguageSelection = "english";
|
||||||
public static readonly ObservableCollection<string> DefaultLanguages = new(new[]
|
public static readonly ObservableCollection<string> DefaultLanguages = new ObservableCollection<string>(new[]
|
||||||
{
|
{
|
||||||
"arabic",
|
"arabic",
|
||||||
"bulgarian",
|
"bulgarian",
|
||||||
|
@ -4,7 +4,7 @@ using Serilog.Exceptions;
|
|||||||
|
|
||||||
namespace auto_creamapi.Utils
|
namespace auto_creamapi.Utils
|
||||||
{
|
{
|
||||||
public static class MyLogger
|
public class MyLogger
|
||||||
{
|
{
|
||||||
public static readonly Logger Log = new LoggerConfiguration()
|
public static readonly Logger Log = new LoggerConfiguration()
|
||||||
.MinimumLevel.Debug()
|
.MinimumLevel.Debug()
|
||||||
|
14
auto-creamapi/Utils/Secrets.EXAMPLE.cs
Normal file
14
auto-creamapi/Utils/Secrets.EXAMPLE.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
namespace auto_creamapi.Utils
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// To use this:
|
||||||
|
/// Rename file Secrets.EXAMPLE.cs to Secrets.cs
|
||||||
|
/// Rename class Secrets_REMOVETHIS to Secrets
|
||||||
|
/// Enter the relevant info below
|
||||||
|
/// </summary>
|
||||||
|
public class Secrets_REMOVETHIS
|
||||||
|
{
|
||||||
|
public const string Username = "Enter username here";
|
||||||
|
public const string Password = "Enter password here";
|
||||||
|
}
|
||||||
|
}
|
@ -1,37 +1,35 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using auto_creamapi.Messenger;
|
using auto_creamapi.Messenger;
|
||||||
using auto_creamapi.Services;
|
using auto_creamapi.Services;
|
||||||
using auto_creamapi.Utils;
|
using auto_creamapi.Utils;
|
||||||
using Microsoft.Extensions.Logging;
|
using MvvmCross.Logging;
|
||||||
using MvvmCross.Navigation;
|
using MvvmCross.Navigation;
|
||||||
using MvvmCross.Plugin.Messenger;
|
using MvvmCross.Plugin.Messenger;
|
||||||
using MvvmCross.ViewModels;
|
using MvvmCross.ViewModels;
|
||||||
|
|
||||||
namespace auto_creamapi.ViewModels
|
namespace auto_creamapi.ViewModels
|
||||||
{
|
{
|
||||||
|
|
||||||
public class DownloadViewModel : MvxNavigationViewModel
|
public class DownloadViewModel : MvxNavigationViewModel
|
||||||
{
|
{
|
||||||
private readonly IDownloadCreamApiService _download;
|
private readonly IDownloadCreamApiService _download;
|
||||||
private readonly IMvxNavigationService _navigationService;
|
private readonly IMvxNavigationService _navigationService;
|
||||||
private readonly MvxSubscriptionToken _token;
|
private readonly MvxSubscriptionToken _token;
|
||||||
private readonly ILogger<DownloadViewModel> _logger;
|
|
||||||
private string _filename;
|
private string _filename;
|
||||||
|
|
||||||
private string _info;
|
private string _info;
|
||||||
private double _progress;
|
private double _progress;
|
||||||
|
|
||||||
private readonly Secrets _secrets = new();
|
public DownloadViewModel(IMvxLogProvider logProvider, IMvxNavigationService navigationService,
|
||||||
|
IDownloadCreamApiService download, IMvxMessenger messenger) : base(logProvider, navigationService)
|
||||||
public DownloadViewModel(ILoggerFactory loggerFactory, IMvxNavigationService navigationService,
|
|
||||||
IDownloadCreamApiService download, IMvxMessenger messenger) : base(loggerFactory, navigationService)
|
|
||||||
{
|
{
|
||||||
_navigationService = navigationService;
|
_navigationService = navigationService;
|
||||||
_logger = loggerFactory.CreateLogger<DownloadViewModel>();
|
|
||||||
_download = download;
|
_download = download;
|
||||||
_token = messenger.Subscribe<ProgressMessage>(OnProgressMessage);
|
_token = messenger.Subscribe<ProgressMessage>(OnProgressMessage);
|
||||||
_logger.LogDebug("{Count}", messenger.CountSubscriptionsFor<ProgressMessage>());
|
MyLogger.Log.Debug("{Count}", messenger.CountSubscriptionsFor<ProgressMessage>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public string InfoLabel
|
public string InfoLabel
|
||||||
@ -79,8 +77,10 @@ namespace auto_creamapi.ViewModels
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
await base.Initialize().ConfigureAwait(false);
|
await base.Initialize().ConfigureAwait(false);
|
||||||
var download = _download.Download(_secrets.ForumUsername(), _secrets.ForumPassword());
|
var download = _download.Download(Secrets.ForumUsername, Secrets.ForumPassword);
|
||||||
var filename = await download.ConfigureAwait(false);
|
var filename = await download.ConfigureAwait(false);
|
||||||
|
/*var extract = _download.Extract(filename);
|
||||||
|
await extract;*/
|
||||||
var extract = _download.Extract(filename);
|
var extract = _download.Extract(filename);
|
||||||
await extract.ConfigureAwait(false);
|
await extract.ConfigureAwait(false);
|
||||||
_token.Dispose();
|
_token.Dispose();
|
||||||
@ -99,6 +99,7 @@ namespace auto_creamapi.ViewModels
|
|||||||
|
|
||||||
private void OnProgressMessage(ProgressMessage obj)
|
private void OnProgressMessage(ProgressMessage obj)
|
||||||
{
|
{
|
||||||
|
//MyLogger.Log.Debug($"{obj.Filename}: {obj.BytesTransferred}");
|
||||||
InfoLabel = obj.Info;
|
InfoLabel = obj.Info;
|
||||||
FilenameLabel = obj.Filename;
|
FilenameLabel = obj.Filename;
|
||||||
Progress = obj.PercentComplete;
|
Progress = obj.PercentComplete;
|
||||||
|
@ -7,7 +7,6 @@ using System.Threading.Tasks;
|
|||||||
using auto_creamapi.Models;
|
using auto_creamapi.Models;
|
||||||
using auto_creamapi.Services;
|
using auto_creamapi.Services;
|
||||||
using auto_creamapi.Utils;
|
using auto_creamapi.Utils;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using MvvmCross.Commands;
|
using MvvmCross.Commands;
|
||||||
using MvvmCross.Navigation;
|
using MvvmCross.Navigation;
|
||||||
@ -20,7 +19,6 @@ namespace auto_creamapi.ViewModels
|
|||||||
private readonly ICacheService _cache;
|
private readonly ICacheService _cache;
|
||||||
private readonly ICreamConfigService _config;
|
private readonly ICreamConfigService _config;
|
||||||
|
|
||||||
private readonly ILogger<MainViewModel> _logger;
|
|
||||||
private readonly ICreamDllService _dll;
|
private readonly ICreamDllService _dll;
|
||||||
private readonly IMvxNavigationService _navigationService;
|
private readonly IMvxNavigationService _navigationService;
|
||||||
private int _appId;
|
private int _appId;
|
||||||
@ -45,10 +43,9 @@ namespace auto_creamapi.ViewModels
|
|||||||
//private const string DlcRegexPattern = @"(?<id>.*) *= *(?<name>.*)";
|
//private const string DlcRegexPattern = @"(?<id>.*) *= *(?<name>.*)";
|
||||||
|
|
||||||
public MainViewModel(ICacheService cache, ICreamConfigService config, ICreamDllService dll,
|
public MainViewModel(ICacheService cache, ICreamConfigService config, ICreamDllService dll,
|
||||||
IMvxNavigationService navigationService, ILoggerFactory loggerFactory)
|
IMvxNavigationService navigationService)
|
||||||
{
|
{
|
||||||
_navigationService = navigationService;
|
_navigationService = navigationService;
|
||||||
_logger = loggerFactory.CreateLogger<MainViewModel>();
|
|
||||||
_cache = cache;
|
_cache = cache;
|
||||||
_config = config;
|
_config = config;
|
||||||
_dll = dll;
|
_dll = dll;
|
||||||
@ -59,7 +56,7 @@ namespace auto_creamapi.ViewModels
|
|||||||
{
|
{
|
||||||
base.Prepare();
|
base.Prepare();
|
||||||
_config.Initialize();
|
_config.Initialize();
|
||||||
var tasks = new List<Task> { _cache.Initialize() };
|
var tasks = new List<Task> {_cache.Initialize()};
|
||||||
if (!File.Exists("steam_api.dll") | !File.Exists("steam_api64.dll"))
|
if (!File.Exists("steam_api.dll") | !File.Exists("steam_api64.dll"))
|
||||||
tasks.Add(_navigationService.Navigate<DownloadViewModel>());
|
tasks.Add(_navigationService.Navigate<DownloadViewModel>());
|
||||||
//tasks.Add(_navigationService.Navigate<DownloadViewModel>());
|
//tasks.Add(_navigationService.Navigate<DownloadViewModel>());
|
||||||
@ -86,8 +83,6 @@ namespace auto_creamapi.ViewModels
|
|||||||
|
|
||||||
public IMvxCommand GoToForumThreadCommand => new MvxCommand(GoToForumThread);
|
public IMvxCommand GoToForumThreadCommand => new MvxCommand(GoToForumThread);
|
||||||
|
|
||||||
public IMvxCommand GoToSteamdbCommand => new MvxCommand(GoToSteamdb);
|
|
||||||
|
|
||||||
// // ATTRIBUTES // //
|
// // ATTRIBUTES // //
|
||||||
|
|
||||||
public bool MainWindowEnabled
|
public bool MainWindowEnabled
|
||||||
@ -315,7 +310,7 @@ namespace auto_creamapi.ViewModels
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Empty game name, cannot initiate search!");
|
MyLogger.Log.Warning("Empty game name, cannot initiate search!");
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindowEnabled = true;
|
MainWindowEnabled = true;
|
||||||
@ -323,10 +318,10 @@ namespace auto_creamapi.ViewModels
|
|||||||
|
|
||||||
private async Task GetListOfDlc()
|
private async Task GetListOfDlc()
|
||||||
{
|
{
|
||||||
Status = "Trying to get DLC, please wait...";
|
Status = "Trying to get DLC...";
|
||||||
if (AppId > 0)
|
if (AppId > 0)
|
||||||
{
|
{
|
||||||
var app = new SteamApp { AppId = AppId, Name = GameName };
|
var app = new SteamApp {AppId = AppId, Name = GameName};
|
||||||
var task = _cache.GetListOfDlc(app, UseSteamDb, IgnoreUnknown);
|
var task = _cache.GetListOfDlc(app, UseSteamDb, IgnoreUnknown);
|
||||||
MainWindowEnabled = false;
|
MainWindowEnabled = false;
|
||||||
var listOfDlc = await task.ConfigureAwait(false);
|
var listOfDlc = await task.ConfigureAwait(false);
|
||||||
@ -346,7 +341,7 @@ namespace auto_creamapi.ViewModels
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Status = $"Could not get DLC for AppID {AppId}";
|
Status = $"Could not get DLC for AppID {AppId}";
|
||||||
_logger.LogError("GetListOfDlc: Invalid AppID {AppId}", AppId);
|
MyLogger.Log.Error("GetListOfDlc: Invalid AppID {AppId}", AppId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -385,7 +380,9 @@ namespace auto_creamapi.ViewModels
|
|||||||
{
|
{
|
||||||
var searchTerm = AppId; //$"{GameName.Replace(" ", "+")}+{appId}";
|
var searchTerm = AppId; //$"{GameName.Replace(" ", "+")}+{appId}";
|
||||||
var destinationUrl =
|
var destinationUrl =
|
||||||
$"https://cs.rin.ru/forum/search.php?keywords={searchTerm}&terms=any&fid[]=10&sf=firstpost&sr=topics&submit=Search";
|
"https://cs.rin.ru/forum/search.php?keywords=" +
|
||||||
|
searchTerm +
|
||||||
|
"&terms=any&fid[]=10&sf=firstpost&sr=topics&submit=Search";
|
||||||
var uri = new Uri(destinationUrl);
|
var uri = new Uri(destinationUrl);
|
||||||
var process = new ProcessStartInfo(uri.AbsoluteUri)
|
var process = new ProcessStartInfo(uri.AbsoluteUri)
|
||||||
{
|
{
|
||||||
@ -395,29 +392,7 @@ namespace auto_creamapi.ViewModels
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_logger.LogError("OpenURL: Invalid AppID {AppId}", AppId);
|
MyLogger.Log.Error("OpenURL: Invalid AppID {AppId}", AppId);
|
||||||
Status = $"Could not open URL: Invalid AppID {AppId}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void GoToSteamdb()
|
|
||||||
{
|
|
||||||
Status = "Opening URL...";
|
|
||||||
if (AppId > 0)
|
|
||||||
{
|
|
||||||
var searchTerm = AppId; //$"{GameName.Replace(" ", "+")}+{appId}";
|
|
||||||
var destinationUrl =
|
|
||||||
$"https://steamdb.info/app/{searchTerm}/dlc/";
|
|
||||||
var uri = new Uri(destinationUrl);
|
|
||||||
var process = new ProcessStartInfo(uri.AbsoluteUri)
|
|
||||||
{
|
|
||||||
UseShellExecute = true
|
|
||||||
};
|
|
||||||
Process.Start(process);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_logger.LogError("OpenURL: Invalid AppID {AppId}", AppId);
|
|
||||||
Status = $"Could not open URL: Invalid AppID {AppId}";
|
Status = $"Could not open URL: Invalid AppID {AppId}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ using System.Collections.Generic;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using auto_creamapi.Models;
|
using auto_creamapi.Models;
|
||||||
using auto_creamapi.Utils;
|
using auto_creamapi.Utils;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using MvvmCross.Commands;
|
using MvvmCross.Commands;
|
||||||
using MvvmCross.Logging;
|
using MvvmCross.Logging;
|
||||||
using MvvmCross.Navigation;
|
using MvvmCross.Navigation;
|
||||||
@ -14,18 +13,16 @@ namespace auto_creamapi.ViewModels
|
|||||||
IMvxViewModel<IEnumerable<SteamApp>, SteamApp>
|
IMvxViewModel<IEnumerable<SteamApp>, SteamApp>
|
||||||
{
|
{
|
||||||
private readonly IMvxNavigationService _navigationService;
|
private readonly IMvxNavigationService _navigationService;
|
||||||
private readonly ILogger<SearchResultViewModel> _logger;
|
|
||||||
private IEnumerable<SteamApp> _steamApps;
|
private IEnumerable<SteamApp> _steamApps;
|
||||||
|
|
||||||
/*public override async Task Initialize()
|
/*public override async Task Initialize()
|
||||||
{
|
{
|
||||||
await base.Initialize();
|
await base.Initialize();
|
||||||
}*/
|
}*/
|
||||||
public SearchResultViewModel(ILoggerFactory loggerFactory, IMvxNavigationService navigationService) : base(
|
public SearchResultViewModel(IMvxLogProvider logProvider, IMvxNavigationService navigationService) : base(
|
||||||
loggerFactory, navigationService)
|
logProvider, navigationService)
|
||||||
{
|
{
|
||||||
_navigationService = navigationService;
|
_navigationService = navigationService;
|
||||||
_logger = loggerFactory.CreateLogger<SearchResultViewModel>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<SteamApp> Apps
|
public IEnumerable<SteamApp> Apps
|
||||||
@ -58,11 +55,9 @@ namespace auto_creamapi.ViewModels
|
|||||||
|
|
||||||
public override void ViewDestroy(bool viewFinishing = true)
|
public override void ViewDestroy(bool viewFinishing = true)
|
||||||
{
|
{
|
||||||
if (viewFinishing && CloseCompletionSource?.Task.IsCompleted == false &&
|
if (viewFinishing && CloseCompletionSource != null && !CloseCompletionSource.Task.IsCompleted &&
|
||||||
!CloseCompletionSource.Task.IsFaulted)
|
!CloseCompletionSource.Task.IsFaulted)
|
||||||
{
|
|
||||||
CloseCompletionSource?.TrySetCanceled();
|
CloseCompletionSource?.TrySetCanceled();
|
||||||
}
|
|
||||||
|
|
||||||
base.ViewDestroy(viewFinishing);
|
base.ViewDestroy(viewFinishing);
|
||||||
}
|
}
|
||||||
@ -71,7 +66,7 @@ namespace auto_creamapi.ViewModels
|
|||||||
{
|
{
|
||||||
if (Selected != null)
|
if (Selected != null)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Successfully got app {Selected}", Selected);
|
MyLogger.Log.Information("Successfully got app {Selected}", Selected);
|
||||||
await _navigationService.Close(this, Selected).ConfigureAwait(false);
|
await _navigationService.Close(this, Selected).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,18 +56,9 @@
|
|||||||
<wcl:WatermarkTextBox Text="{Binding AppId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
<wcl:WatermarkTextBox Text="{Binding AppId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
HorizontalAlignment="Right" Margin="0,10,10,0" Watermark="AppID" TextWrapping="Wrap"
|
HorizontalAlignment="Right" Margin="0,10,10,0" Watermark="AppID" TextWrapping="Wrap"
|
||||||
VerticalAlignment="Top" Width="120" Padding="0" Grid.Row="1" />
|
VerticalAlignment="Top" Width="120" Padding="0" Grid.Row="1" />
|
||||||
<Grid Grid.Row="2" Margin="10,10,0,0">
|
<TextBlock Grid.Row="2" Margin="10,10,10,0">
|
||||||
<Grid.ColumnDefinitions>
|
<Hyperlink Command="{Binding GoToForumThreadCommand}">Search for cs.rin.ru thread</Hyperlink>
|
||||||
<ColumnDefinition Width="Auto"/>
|
</TextBlock>
|
||||||
<ColumnDefinition Width="Auto"/>
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<TextBlock Grid.Column="0" Margin="0,0,10,0">
|
|
||||||
<Hyperlink Command="{Binding GoToForumThreadCommand}">Search for cs.rin.ru thread...</Hyperlink>
|
|
||||||
</TextBlock>
|
|
||||||
<TextBlock Grid.Column="1" Margin="0,0,0,0">
|
|
||||||
<Hyperlink Command="{Binding GoToSteamdbCommand}">Open SteamDB DLC page...</Hyperlink>
|
|
||||||
</TextBlock>
|
|
||||||
</Grid>
|
|
||||||
<ComboBox ItemsSource="{Binding Path=Languages}" SelectedItem="{Binding Path=Lang, Mode=TwoWay}"
|
<ComboBox ItemsSource="{Binding Path=Languages}" SelectedItem="{Binding Path=Lang, Mode=TwoWay}"
|
||||||
HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="120" Grid.Row="3" />
|
HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="120" Grid.Row="3" />
|
||||||
<CheckBox Content="Force offline mode" IsChecked="{Binding Offline, Mode=TwoWay}"
|
<CheckBox Content="Force offline mode" IsChecked="{Binding Offline, Mode=TwoWay}"
|
||||||
|
@ -1,61 +1,57 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
<RootNamespace>auto_creamapi</RootNamespace>
|
<RootNamespace>auto_creamapi</RootNamespace>
|
||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
<PackageVersion>2.2.0</PackageVersion>
|
<PackageVersion>2.1.7</PackageVersion>
|
||||||
<Title>auto-creamapi</Title>
|
<Title>auto-creamapi</Title>
|
||||||
<Authors>Jeddunk</Authors>
|
<Authors>Jeddunk</Authors>
|
||||||
<Company>jeddunk.xyz</Company>
|
<Company>jeddunk.xyz</Company>
|
||||||
<AssemblyVersion>2.2.0</AssemblyVersion>
|
<AssemblyVersion>2.1.7</AssemblyVersion>
|
||||||
<FileVersion>2.2.0</FileVersion>
|
<FileVersion>2.1.7</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||||
<DebugType>none</DebugType>
|
<DebugType>none</DebugType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AngleSharp" Version="1.0.7" />
|
<PackageReference Include="AngleSharp" Version="0.14.0" />
|
||||||
<PackageReference Include="Ben.Demystifier" Version="0.4.1" />
|
<PackageReference Include="Ben.Demystifier" Version="0.3.0" />
|
||||||
<PackageReference Include="bloomtom.HttpProgress" Version="2.3.2" />
|
<PackageReference Include="bloomtom.HttpProgress" Version="2.3.2" />
|
||||||
<PackageReference Include="Dirkster.WatermarkControlsLib" Version="1.1.0" />
|
<PackageReference Include="Dirkster.WatermarkControlsLib" Version="1.1.0" />
|
||||||
<PackageReference Include="ini-parser-netstandard" Version="2.5.2" />
|
<PackageReference Include="ini-parser-netstandard" Version="2.5.2" />
|
||||||
<PackageReference Include="MvvmCross" Version="8.0.2" />
|
<PackageReference Include="MvvmCross" Version="7.1.2" />
|
||||||
<PackageReference Include="MvvmCross.Platforms.Wpf" Version="8.0.2" />
|
<PackageReference Include="MvvmCross.Platforms.Wpf" Version="7.1.2" />
|
||||||
<PackageReference Include="MvvmCross.Plugin.Messenger" Version="8.0.2" />
|
<PackageReference Include="MvvmCross.Plugin.Messenger" Version="7.1.2" />
|
||||||
<PackageReference Include="NinjaNye.SearchExtensions" Version="3.0.1" />
|
<PackageReference Include="NinjaNye.SearchExtensions" Version="3.0.1" />
|
||||||
<PackageReference Include="Serilog" Version="3.1.1" />
|
<PackageReference Include="Serilog" Version="2.10.0" />
|
||||||
<PackageReference Include="Serilog.Exceptions" Version="8.4.0" />
|
<PackageReference Include="Serilog.Exceptions" Version="6.0.0" />
|
||||||
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
|
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
|
||||||
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
|
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
<PackageReference Include="Squid-Box.SevenZipSharp" Version="1.3.283" />
|
||||||
<PackageReference Include="Squid-Box.SevenZipSharp" Version="1.6.1.23" />
|
<PackageReference Include="SteamStorefrontAPI.NETStandard" Version="1.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Page Include="App.xaml" />
|
<Page Include="App.xaml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="README.md">
|
<Content Include="README.md">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="COPYING">
|
<Content Include="COPYING">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="resources\CourierPrime-Regular.ttf">
|
<Content Include="resources\CourierPrime-Regular.ttf">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="resources\7z.dll">
|
<Content Include="resources\7z.dll">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\SteamStorefrontAPI\SteamStorefrontAPI\SteamStorefrontAPI.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in New Issue
Block a user