Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions Configuration/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ namespace Quaver.Steam.Deploy.Configuration
{
public class Config
{
private static string ConfigPath { get; set; }

/// <summary>
/// Steam Username
/// </summary>
Expand Down Expand Up @@ -37,7 +39,7 @@ public class Config
/// <summary>
/// Quaver API JWT
/// </summary>
public string QuaverAPIJWT { get; set; } = "";
public string QuaverApijwt { get; set; } = "";

/// <summary>
/// Whether or not the script will deploy the builds to Steam
Expand All @@ -48,33 +50,38 @@ public class Config
/// Run .NET Reactor
/// </summary>
public bool RunReactor { get; set; }

/// <summary>
/// Optional path to a macOS app icon file (.icns, .png, or .ico).
/// </summary>
public string MacAppIconPath { get; set; } = "";

/// <summary>
/// The path of the config file.
/// </summary>
public static string Path => $"{Directory.GetCurrentDirectory()}/config.json";
public static string Path => ConfigPath ?? System.IO.Path.Combine(Directory.GetCurrentDirectory(), "config.json");

/// <summary>
/// Deserializes the config into an object.
/// </summary>
/// <returns></returns>
public static Config Deserialize()
public static Config Deserialize(string path = null)
{
const string path = "./config.json";
ConfigPath = path ?? Path;

// If the file doesn't exist, then we'll want to create the file, then throw a FileNotFoundException
if (!File.Exists(path))
if (!File.Exists(ConfigPath))
{
var config = new Config();
config.Save();

throw new FileNotFoundException("config.json file was not found. A template has been created for you.");
throw new FileNotFoundException($"config.json file was not found at {ConfigPath}. A template has been created for you.");
}

Config parsedConfig;

// Deserialize it if it already exists.
using (var fileStream = File.OpenRead(path))
using (var fileStream = File.OpenRead(ConfigPath))
{
parsedConfig = JsonSerializer.Deserialize<Config>(fileStream);
}
Expand All @@ -101,4 +108,4 @@ private void Save()
}
}
}
}
}
Binary file added Images/Quaver.icns
Binary file not shown.
Binary file added Images/Quaver.iconset/icon_128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/Quaver.iconset/icon_128x128@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/Quaver.iconset/icon_16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/Quaver.iconset/icon_16x16@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/Quaver.iconset/icon_256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/Quaver.iconset/icon_256x256@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/Quaver.iconset/icon_32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/Quaver.iconset/icon_32x32@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/Quaver.iconset/icon_512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/Quaver.iconset/icon_512x512@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading