Merge branch 'LelouBil-master'
This commit is contained in:
4 files changed
+33
-4
No files matched your search
@@ -11,6 +11,7 @@ using Mono.Cecil;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Reactor.Greenhouse.Setup;
|
||||
using Reactor.Greenhouse.Setup.Provider;
|
||||
using Reactor.OxygenFilter;
|
||||
|
||||
namespace Reactor.Greenhouse
|
||||
@@ -33,6 +34,7 @@ namespace Reactor.Greenhouse
|
||||
public static async Task GenerateAsync(bool steam, bool itch)
|
||||
{
|
||||
var gameManager = new GameManager();
|
||||
|
||||
await gameManager.SetupAsync(steam, itch);
|
||||
|
||||
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
|
||||
@@ -46,6 +48,12 @@ namespace Reactor.Greenhouse
|
||||
Console.WriteLine($"Generating mappings from {gameManager.PreObfuscation.Name} ({gameManager.PreObfuscation.Version})");
|
||||
using var old = ModuleDefinition.ReadModule(File.OpenRead(gameManager.PreObfuscation.Dll));
|
||||
|
||||
if (!steam && !itch)
|
||||
{
|
||||
Console.WriteLine("No game providers used! (use --help for more info)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (steam)
|
||||
{
|
||||
await GenerateAsync(gameManager.Steam, old);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Reactor.Greenhouse.Setup.Provider
|
||||
@@ -10,4 +11,14 @@ namespace Reactor.Greenhouse.Setup.Provider
|
||||
public abstract Task DownloadAsync();
|
||||
public abstract bool IsUpdateNeeded();
|
||||
}
|
||||
|
||||
public class ProviderConnectionException : Exception
|
||||
{
|
||||
public BaseProvider Provider { get; }
|
||||
|
||||
public ProviderConnectionException(BaseProvider provider, string message) : base(message)
|
||||
{
|
||||
Provider = provider;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,6 @@ namespace Reactor.Greenhouse.Setup.Provider
|
||||
|
||||
Console.Write("itch.io password: ");
|
||||
Password = Util.ReadPassword();
|
||||
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
@@ -63,7 +62,7 @@ namespace Reactor.Greenhouse.Setup.Provider
|
||||
|
||||
if (!loginResponse.IsSuccessStatusCode || (await loginResponse.Content.ReadAsStringAsync()).Contains("Errors"))
|
||||
{
|
||||
throw new Exception("itch.io authentication failed");
|
||||
throw new ProviderConnectionException(this, "Authentication failed");
|
||||
}
|
||||
|
||||
Console.WriteLine("Logged into itch.io");
|
||||
|
||||
@@ -67,7 +67,10 @@ namespace Reactor.Greenhouse.Setup.Provider
|
||||
if (environmentVariable != null)
|
||||
{
|
||||
var split = environmentVariable.Split(":");
|
||||
ContentDownloader.InitializeSteam3(split[0], split[1]);
|
||||
if (!ContentDownloader.InitializeSteam3(split[0], split[1]))
|
||||
{
|
||||
throw new ProviderConnectionException(this, "Incorrect credentials.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -85,7 +88,15 @@ namespace Reactor.Greenhouse.Setup.Provider
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
ContentDownloader.InitializeSteam3(username, password);
|
||||
if (!ContentDownloader.InitializeSteam3(username, password))
|
||||
{
|
||||
throw new ProviderConnectionException(this, "Incorrect credentials.");
|
||||
}
|
||||
}
|
||||
|
||||
if (ContentDownloader.steam3 == null || !ContentDownloader.steam3.bConnected)
|
||||
{
|
||||
throw new ProviderConnectionException(this, "Unable to initialize Steam3 session.");
|
||||
}
|
||||
|
||||
ContentDownloader.Config.UsingFileList = true;
|
||||
|
||||
Reference in new issue
Block a user