From 007588de38919f500d3a60e23d964c9d8e25583b Mon Sep 17 00:00:00 2001 From: Carson McManus Date: Thu, 25 Aug 2016 21:52:21 -0400 Subject: [PATCH] made a prompt to create a new manifest.json if not using the default folder --- Manifest.cs | 17 +++++++++++++++-- Program.cs | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Manifest.cs b/Manifest.cs index c71a01f..4f94bc2 100644 --- a/Manifest.cs +++ b/Manifest.cs @@ -63,8 +63,21 @@ public class Manifest if (!File.Exists(maFile)) { if (Program.Verbose) Console.WriteLine("warn: No manifest file found at {0}", maFile); - _manifest = _generateNewManifest(true); - return _manifest; + bool? createNewManifest = Program.SteamGuardPath == + Program.defaultSteamGuardPath.Replace("~", Environment.GetEnvironmentVariable("HOME")) ? true : (bool?) null; + while (createNewManifest == null) + { + Console.Write($"Generate new manifest.json in {Program.SteamGuardPath}? [Y/n]"); + var answer = Console.ReadLine(); + if (answer != null) + createNewManifest = !answer.StartsWith("n") && !answer.StartsWith("N"); + } + if ((bool) createNewManifest) + { + _manifest = _generateNewManifest(true); + return _manifest; + } + return null; } try diff --git a/Program.cs b/Program.cs index 8cecf44..381c7b9 100644 --- a/Program.cs +++ b/Program.cs @@ -11,7 +11,7 @@ using System.Threading.Tasks; public static class Program { - const string defaultSteamGuardPath = "~/maFiles"; + public const string defaultSteamGuardPath = "~/maFiles"; public static string SteamGuardPath { get; set; } = defaultSteamGuardPath; public static Manifest Manifest { get; set; }