Compare commits
No commits in common. "3c736674acff48559f6f2941c861ea4ad939739e" and "178b7427b8c06077a5d98fa13bb1c02f250dfb92" have entirely different histories.
3c736674ac
...
178b7427b8
@ -84,18 +84,18 @@ namespace auto_creamapi.Services
|
|||||||
|
|
||||||
public SteamApp GetAppByName(string name)
|
public SteamApp GetAppByName(string name)
|
||||||
{
|
{
|
||||||
MyLogger.Log.Information("Trying to get app {Name}", name);
|
MyLogger.Log.Information($"Trying to get app {name}");
|
||||||
var comparableName = Regex.Replace(name, Misc.SpecialCharsRegex, "").ToLower();
|
var comparableName = Regex.Replace(name, Misc.SpecialCharsRegex, "").ToLower();
|
||||||
var app = _cache.FirstOrDefault(x => x.CompareName(comparableName));
|
var app = _cache.FirstOrDefault(x => x.CompareName(comparableName));
|
||||||
if (app != null) MyLogger.Log.Information("Successfully got app {App}", app);
|
if (app != null) MyLogger.Log.Information($"Successfully got app {app}");
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SteamApp GetAppById(int appid)
|
public SteamApp GetAppById(int appid)
|
||||||
{
|
{
|
||||||
MyLogger.Log.Information("Trying to get app with ID {AppId}", appid);
|
MyLogger.Log.Information($"Trying to get app with ID {appid}");
|
||||||
var app = _cache.FirstOrDefault(x => x.AppId.Equals(appid));
|
var app = _cache.FirstOrDefault(x => x.AppId.Equals(appid));
|
||||||
if (app != null) MyLogger.Log.Information("Successfully got app {App}", app);
|
if (app != null) MyLogger.Log.Information($"Successfully got app {app}");
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ namespace auto_creamapi.Services
|
|||||||
var steamAppDetails = await AppDetails.GetAsync(steamApp.AppId).ConfigureAwait(false);
|
var steamAppDetails = await AppDetails.GetAsync(steamApp.AppId).ConfigureAwait(false);
|
||||||
if (steamAppDetails != null)
|
if (steamAppDetails != null)
|
||||||
{
|
{
|
||||||
MyLogger.Log.Debug("Type for Steam App {Name}: \"{Type}\"", steamApp.Name, steamAppDetails.Type);
|
MyLogger.Log.Debug($"Type for Steam App {steamApp.Name}: \"{steamAppDetails.Type}\"");
|
||||||
if (steamAppDetails.Type == "game" | steamAppDetails.Type == "demo")
|
if (steamAppDetails.Type == "game" | steamAppDetails.Type == "demo")
|
||||||
{
|
{
|
||||||
steamAppDetails.DLC.ForEach(x =>
|
steamAppDetails.DLC.ForEach(x =>
|
||||||
@ -121,7 +121,7 @@ namespace auto_creamapi.Services
|
|||||||
: 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($"{x.AppId}={x.Name}"));
|
||||||
MyLogger.Log.Information("Got DLC successfully...");
|
MyLogger.Log.Information("Got DLC successfully...");
|
||||||
|
|
||||||
if (!useSteamDb) return dlcList;
|
if (!useSteamDb) return dlcList;
|
||||||
@ -138,12 +138,12 @@ namespace auto_creamapi.Services
|
|||||||
MyLogger.Log.Information("Get SteamDB App");
|
MyLogger.Log.Information("Get SteamDB App");
|
||||||
var httpCall = client.GetAsync(steamDbUri);
|
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(httpCall.Status.ToString());
|
||||||
MyLogger.Log.Debug("{Boolean}", response.EnsureSuccessStatusCode().ToString());
|
MyLogger.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);
|
||||||
MyLogger.Log.Debug("{Status}", readAsStringAsync.Status.ToString());
|
MyLogger.Log.Debug(readAsStringAsync.Status.ToString());
|
||||||
|
|
||||||
var parser = new HtmlParser();
|
var parser = new HtmlParser();
|
||||||
var doc = parser.ParseDocument(responseBody);
|
var doc = parser.ParseDocument(responseBody);
|
||||||
@ -163,7 +163,7 @@ namespace auto_creamapi.Services
|
|||||||
|
|
||||||
if (ignoreUnknown && dlcName.Contains("SteamDB Unknown App"))
|
if (ignoreUnknown && dlcName.Contains("SteamDB Unknown App"))
|
||||||
{
|
{
|
||||||
MyLogger.Log.Information("Skipping SteamDB Unknown App {DlcId}", dlcId);
|
MyLogger.Log.Information($"Skipping SteamDB Unknown App {dlcId}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -179,7 +179,7 @@ namespace auto_creamapi.Services
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dlcList.ForEach(x => MyLogger.Log.Debug("{AppId}={Name}", x.AppId, x.Name));
|
dlcList.ForEach(x => MyLogger.Log.Debug($"{x.AppId}={x.Name}"));
|
||||||
MyLogger.Log.Information("Got DLC from SteamDB successfully...");
|
MyLogger.Log.Information("Got DLC from SteamDB successfully...");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -65,7 +65,7 @@ namespace auto_creamapi.Services
|
|||||||
_configFilePath = configFilePath;
|
_configFilePath = configFilePath;
|
||||||
if (File.Exists(configFilePath))
|
if (File.Exists(configFilePath))
|
||||||
{
|
{
|
||||||
MyLogger.Log.Information("Config file found @ {ConfigFilePath}, parsing...", configFilePath);
|
MyLogger.Log.Information($"Config file found @ {configFilePath}, parsing...");
|
||||||
var parser = new FileIniDataParser();
|
var parser = new FileIniDataParser();
|
||||||
var data = parser.ReadFile(_configFilePath, Encoding.UTF8);
|
var data = parser.ReadFile(_configFilePath, Encoding.UTF8);
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ namespace auto_creamapi.Services
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MyLogger.Log.Information("Config file does not exist @ {ConfigFilePath}, skipping...", configFilePath);
|
MyLogger.Log.Information($"Config file does not exist @ {configFilePath}, skipping...");
|
||||||
ResetConfigData();
|
ResetConfigData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,8 +66,8 @@ namespace auto_creamapi.Services
|
|||||||
var x64File = Path.Combine(TargetPath, "steam_api64.dll");
|
var x64File = Path.Combine(TargetPath, "steam_api64.dll");
|
||||||
_x86Exists = File.Exists(x86File);
|
_x86Exists = File.Exists(x86File);
|
||||||
_x64Exists = File.Exists(x64File);
|
_x64Exists = File.Exists(x64File);
|
||||||
if (_x86Exists) MyLogger.Log.Information("x86 SteamAPI DLL found: {X}", x86File);
|
if (_x86Exists) MyLogger.Log.Information($"x86 SteamAPI DLL found: {x86File}");
|
||||||
if (_x64Exists) MyLogger.Log.Information("x64 SteamAPI DLL found: {X}", x64File);
|
if (_x64Exists) MyLogger.Log.Information($"x64 SteamAPI DLL found: {x64File}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CreamApiApplied()
|
public bool CreamApiApplied()
|
||||||
@ -83,7 +83,7 @@ namespace auto_creamapi.Services
|
|||||||
var targetSteamApiDll = Path.Combine(TargetPath, _creamDlls[arch].Filename);
|
var targetSteamApiDll = Path.Combine(TargetPath, _creamDlls[arch].Filename);
|
||||||
var targetSteamApiOrigDll = Path.Combine(TargetPath, _creamDlls[arch].OrigFilename);
|
var targetSteamApiOrigDll = Path.Combine(TargetPath, _creamDlls[arch].OrigFilename);
|
||||||
var targetSteamApiDllBackup = Path.Combine(TargetPath, $"{_creamDlls[arch].Filename}.backup");
|
var targetSteamApiDllBackup = Path.Combine(TargetPath, $"{_creamDlls[arch].Filename}.backup");
|
||||||
MyLogger.Log.Information("Setting up CreamAPI DLL @ {TargetPath} (arch :{Arch})", TargetPath, arch);
|
MyLogger.Log.Information($"Setting up CreamAPI DLL @ {TargetPath} (arch :{arch})");
|
||||||
// Create backup of steam_api.dll
|
// Create backup of steam_api.dll
|
||||||
File.Copy(targetSteamApiDll, targetSteamApiDllBackup, true);
|
File.Copy(targetSteamApiDll, targetSteamApiDllBackup, true);
|
||||||
// Check if steam_api_o.dll already exists
|
// Check if steam_api_o.dll already exists
|
||||||
|
@ -4,6 +4,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using auto_creamapi.Messenger;
|
using auto_creamapi.Messenger;
|
||||||
@ -36,8 +37,6 @@ namespace auto_creamapi.Services
|
|||||||
var container = new CookieContainer();
|
var container = new CookieContainer();
|
||||||
var handler = new HttpClientHandler {CookieContainer = container};
|
var handler = new HttpClientHandler {CookieContainer = container};
|
||||||
var client = new HttpClient(handler);
|
var client = new HttpClient(handler);
|
||||||
client.DefaultRequestHeaders.UserAgent.ParseAdd("Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:86.0) " +
|
|
||||||
"Gecko/20100101 Firefox/86.0");
|
|
||||||
var formContent = new FormUrlEncodedContent(new[]
|
var formContent = new FormUrlEncodedContent(new[]
|
||||||
{
|
{
|
||||||
new KeyValuePair<string, string>("username", username),
|
new KeyValuePair<string, string>("username", username),
|
||||||
@ -48,15 +47,14 @@ namespace auto_creamapi.Services
|
|||||||
MyLogger.Log.Debug("Download: post login");
|
MyLogger.Log.Debug("Download: post login");
|
||||||
var response1 = await client.PostAsync("https://cs.rin.ru/forum/ucp.php?mode=login", formContent)
|
var response1 = await client.PostAsync("https://cs.rin.ru/forum/ucp.php?mode=login", formContent)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
MyLogger.Log.Debug("Login Status Code: {StatusCode}",
|
MyLogger.Log.Debug($"Login Status Code: {response1.EnsureSuccessStatusCode().StatusCode.ToString()}");
|
||||||
response1.EnsureSuccessStatusCode().StatusCode);
|
|
||||||
var cookie = container.GetCookies(new Uri("https://cs.rin.ru/forum/ucp.php?mode=login"))
|
var cookie = container.GetCookies(new Uri("https://cs.rin.ru/forum/ucp.php?mode=login"))
|
||||||
.FirstOrDefault(c => c.Name.Contains("_sid"));
|
.FirstOrDefault(c => c.Name.Contains("_sid"));
|
||||||
MyLogger.Log.Debug("Login Cookie: {Cookie}", cookie);
|
MyLogger.Log.Debug($"Login Cookie: {cookie}");
|
||||||
var response2 = await client.GetAsync("https://cs.rin.ru/forum/viewtopic.php?t=70576")
|
var response2 = await client.GetAsync("https://cs.rin.ru/forum/viewtopic.php?t=70576")
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
MyLogger.Log.Debug("Download Page Status Code: {StatusCode}",
|
MyLogger.Log.Debug(
|
||||||
response2.EnsureSuccessStatusCode().StatusCode);
|
$"Download Page Status Code: {response2.EnsureSuccessStatusCode().StatusCode.ToString()}");
|
||||||
var content = response2.Content.ReadAsStringAsync();
|
var content = response2.Content.ReadAsStringAsync();
|
||||||
var contentResult = await content.ConfigureAwait(false);
|
var contentResult = await content.ConfigureAwait(false);
|
||||||
|
|
||||||
@ -73,7 +71,7 @@ namespace auto_creamapi.Services
|
|||||||
{
|
{
|
||||||
archiveFileList.Add(match.Groups["filename"].Value,
|
archiveFileList.Add(match.Groups["filename"].Value,
|
||||||
$"https://cs.rin.ru/forum{match.Groups["url"].Value}");
|
$"https://cs.rin.ru/forum{match.Groups["url"].Value}");
|
||||||
MyLogger.Log.Debug("{X}", archiveFileList.LastOrDefault().Key);
|
MyLogger.Log.Debug(archiveFileList.LastOrDefault().Key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +79,7 @@ namespace auto_creamapi.Services
|
|||||||
var (filename, url) = archiveFileList.FirstOrDefault();
|
var (filename, url) = archiveFileList.FirstOrDefault();
|
||||||
if (File.Exists(filename))
|
if (File.Exists(filename))
|
||||||
{
|
{
|
||||||
MyLogger.Log.Information("{Filename} already exists, skipping download...", filename);
|
MyLogger.Log.Information($"{filename} already exists, skipping download...");
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +102,7 @@ namespace auto_creamapi.Services
|
|||||||
const string nonlogBuild = "nonlog_build";
|
const string nonlogBuild = "nonlog_build";
|
||||||
const string steamApi64Dll = "steam_api64.dll";
|
const string steamApi64Dll = "steam_api64.dll";
|
||||||
const string steamApiDll = "steam_api.dll";
|
const string steamApiDll = "steam_api.dll";
|
||||||
MyLogger.Log.Information(@"Start extraction of ""{Filename}""...", filename);
|
MyLogger.Log.Information($@"Start extraction of ""{filename}""...");
|
||||||
var nonlogBuildPath = Path.Combine(cwd, nonlogBuild);
|
var nonlogBuildPath = Path.Combine(cwd, nonlogBuild);
|
||||||
if (Directory.Exists(nonlogBuildPath))
|
if (Directory.Exists(nonlogBuildPath))
|
||||||
Directory.Delete(nonlogBuildPath, true);
|
Directory.Delete(nonlogBuildPath, true);
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
using System;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
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;
|
||||||
@ -29,7 +26,7 @@ namespace auto_creamapi.ViewModels
|
|||||||
_navigationService = navigationService;
|
_navigationService = navigationService;
|
||||||
_download = download;
|
_download = download;
|
||||||
_token = messenger.Subscribe<ProgressMessage>(OnProgressMessage);
|
_token = messenger.Subscribe<ProgressMessage>(OnProgressMessage);
|
||||||
MyLogger.Log.Debug("{Count}", messenger.CountSubscriptionsFor<ProgressMessage>());
|
MyLogger.Log.Debug(messenger.CountSubscriptionsFor<ProgressMessage>().ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public string InfoLabel
|
public string InfoLabel
|
||||||
@ -65,36 +62,20 @@ namespace auto_creamapi.ViewModels
|
|||||||
|
|
||||||
public string ProgressPercent => _progress.ToString("P2");
|
public string ProgressPercent => _progress.ToString("P2");
|
||||||
|
|
||||||
public override void Prepare()
|
public override async Task Initialize()
|
||||||
{
|
{
|
||||||
|
await base.Initialize().ConfigureAwait(false);
|
||||||
InfoLabel = "Please wait...";
|
InfoLabel = "Please wait...";
|
||||||
FilenameLabel = "";
|
FilenameLabel = "";
|
||||||
Progress = 0.0;
|
Progress = 0.0;
|
||||||
}
|
var download = _download.Download(Secrets.ForumUsername, Secrets.ForumPassword);
|
||||||
|
var filename = await download.ConfigureAwait(false);
|
||||||
public override async Task Initialize()
|
/*var extract = _download.Extract(filename);
|
||||||
{
|
await extract;*/
|
||||||
try
|
var extract = _download.Extract(filename);
|
||||||
{
|
await extract.ConfigureAwait(false);
|
||||||
await base.Initialize().ConfigureAwait(false);
|
_token.Dispose();
|
||||||
var download = _download.Download(Secrets.ForumUsername, Secrets.ForumPassword);
|
await _navigationService.Close(this).ConfigureAwait(false);
|
||||||
var filename = await download.ConfigureAwait(false);
|
|
||||||
/*var extract = _download.Extract(filename);
|
|
||||||
await extract;*/
|
|
||||||
var extract = _download.Extract(filename);
|
|
||||||
await extract.ConfigureAwait(false);
|
|
||||||
_token.Dispose();
|
|
||||||
await _navigationService.Close(this).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Could not download CreamAPI!\nPlease add CreamAPI DLLs manually!\nShutting down...",
|
|
||||||
"Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
_token.Dispose();
|
|
||||||
await _navigationService.Close(this).ConfigureAwait(false);
|
|
||||||
Console.WriteLine(e);
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnProgressMessage(ProgressMessage obj)
|
private void OnProgressMessage(ProgressMessage obj)
|
||||||
|
@ -69,6 +69,11 @@ namespace auto_creamapi.ViewModels
|
|||||||
Status = "Ready.";
|
Status = "Ready.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Task Initialize()
|
||||||
|
{
|
||||||
|
return base.Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
// // COMMANDS // //
|
// // COMMANDS // //
|
||||||
|
|
||||||
public IMvxCommand OpenFileCommand => new MvxAsyncCommand(OpenFile);
|
public IMvxCommand OpenFileCommand => new MvxAsyncCommand(OpenFile);
|
||||||
@ -270,7 +275,7 @@ namespace auto_creamapi.ViewModels
|
|||||||
var s = index > -1 ? strings[index] : null;
|
var s = index > -1 ? strings[index] : null;
|
||||||
if (s != null) GameName = s;
|
if (s != null) GameName = s;
|
||||||
await Search().ConfigureAwait(false);
|
await Search().ConfigureAwait(false);
|
||||||
// await GetListOfDlc().ConfigureAwait(false);
|
await GetListOfDlc().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = "Ready.";
|
Status = "Ready.";
|
||||||
@ -306,7 +311,7 @@ namespace auto_creamapi.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// await GetListOfDlc().ConfigureAwait(false);
|
await GetListOfDlc().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -341,7 +346,7 @@ namespace auto_creamapi.ViewModels
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Status = $"Could not get DLC for AppID {AppId}";
|
Status = $"Could not get DLC for AppID {AppId}";
|
||||||
MyLogger.Log.Error("GetListOfDlc: Invalid AppID {AppId}", AppId);
|
MyLogger.Log.Error($"GetListOfDlc: Invalid AppID {AppId}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,7 +397,7 @@ namespace auto_creamapi.ViewModels
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MyLogger.Log.Error("OpenURL: Invalid AppID {AppId}", AppId);
|
MyLogger.Log.Error($"OpenURL: Invalid AppID {AppId}");
|
||||||
Status = $"Could not open URL: Invalid AppID {AppId}";
|
Status = $"Could not open URL: Invalid AppID {AppId}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ namespace auto_creamapi.ViewModels
|
|||||||
{
|
{
|
||||||
if (Selected != null)
|
if (Selected != null)
|
||||||
{
|
{
|
||||||
MyLogger.Log.Information("Successfully got app {Selected}", Selected);
|
MyLogger.Log.Information($"Successfully got app {Selected}");
|
||||||
await _navigationService.Close(this, Selected).ConfigureAwait(false);
|
await _navigationService.Close(this, Selected).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user