From e44fd6b580ddc973dcfa2de40518cace8e1b459e Mon Sep 17 00:00:00 2001 From: cirion02 <34488326+cirion02@users.noreply.github.com> Date: Sat, 25 Mar 2023 22:39:43 +0100 Subject: [PATCH] Fix file paths --- BingoForcing/BoardGeneration/BoardsFileGenerator.cs | 2 +- BingoForcing/DataGathering/ObjectiveCounts.cs | 4 ++-- .../LetterToObjectiveLookup.cs | 6 +++--- BingoForcing/JsonParsers/GeneratorJsonParser.cs | 2 +- BingoForcing/UI/UI.cs | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/BingoForcing/BoardGeneration/BoardsFileGenerator.cs b/BingoForcing/BoardGeneration/BoardsFileGenerator.cs index 865ec68..febbf0a 100644 --- a/BingoForcing/BoardGeneration/BoardsFileGenerator.cs +++ b/BingoForcing/BoardGeneration/BoardsFileGenerator.cs @@ -9,7 +9,7 @@ public static void WriteBoardsToFile(string filename, int count, int min = 0) Objective[][] generatorJson = GeneratorJsonParser.ParseJsonFile(filename); BoardGenerator generator = new BoardGenerator(generatorJson); - using StreamWriter sw = new StreamWriter(@"../../../BoardsFiles/" + filename + ".txt"); + using StreamWriter sw = new StreamWriter(@"BoardsFiles/" + filename + ".txt"); for (int i = min; i < count + min; i++) { diff --git a/BingoForcing/DataGathering/ObjectiveCounts.cs b/BingoForcing/DataGathering/ObjectiveCounts.cs index 118a576..d861666 100644 --- a/BingoForcing/DataGathering/ObjectiveCounts.cs +++ b/BingoForcing/DataGathering/ObjectiveCounts.cs @@ -31,7 +31,7 @@ public static int[][] GetObjectiveCounts(string filename) counts[i] = new int[14]; } - using StreamReader sr = new StreamReader(@"../../../BoardsFiles/" + filename + ".txt"); + using StreamReader sr = new StreamReader(@"BoardsFiles/" + filename + ".txt"); string? line; while ((line = sr.ReadLine()) != null) @@ -51,7 +51,7 @@ public static void WriteObjectiveCounts(string filename) Objective[][] objectives = GeneratorJsonParser.ParseJsonFile(filename); - using StreamWriter sw = new StreamWriter(@"../../../Output/ObjectiveCounts/" + filename + ".txt"); + using StreamWriter sw = new StreamWriter(@"Output/ObjectiveCounts/" + filename + ".txt"); for (int i = 0; i < 25; i++) { diff --git a/BingoForcing/GeneratorHelperFileGenerators/LetterToObjectiveLookup.cs b/BingoForcing/GeneratorHelperFileGenerators/LetterToObjectiveLookup.cs index 8b68e24..79b00b2 100644 --- a/BingoForcing/GeneratorHelperFileGenerators/LetterToObjectiveLookup.cs +++ b/BingoForcing/GeneratorHelperFileGenerators/LetterToObjectiveLookup.cs @@ -9,7 +9,7 @@ public static class LetterToObjectiveLookup public static void CreateLetterToObjectiveJson(string filename) { - Objective[][] generator = GeneratorJsonParser.ParseJsonFile(@"../../../GeneratorJsons/" + filename + ".json"); + Objective[][] generator = GeneratorJsonParser.ParseJsonFile(@"GeneratorJsons/" + filename + ".json"); Dictionary[] result = new Dictionary[25]; @@ -24,12 +24,12 @@ public static void CreateLetterToObjectiveJson(string filename) string json = JsonConvert.SerializeObject(result); - File.WriteAllText(@"../../../GeneratorLookups/" + filename + ".json", json); + File.WriteAllText(@"GeneratorLookups/" + filename + ".json", json); } public static Dictionary[] ReadLetterToObjectiveJson(string filename) { - string text = File.ReadAllText(@"../../../GeneratorLookups/" + filename + ".json"); + string text = File.ReadAllText(@"GeneratorLookups/" + filename + ".json"); return JsonConvert.DeserializeObject[]>(text) ?? Array.Empty>(); } } \ No newline at end of file diff --git a/BingoForcing/JsonParsers/GeneratorJsonParser.cs b/BingoForcing/JsonParsers/GeneratorJsonParser.cs index f1adbac..3ebbb8f 100644 --- a/BingoForcing/JsonParsers/GeneratorJsonParser.cs +++ b/BingoForcing/JsonParsers/GeneratorJsonParser.cs @@ -6,7 +6,7 @@ public static class GeneratorJsonParser { public static Objective[][] ParseJsonFile(string filename) { - string text = File.ReadAllText(@"../../../GeneratorJsons/" + filename + ".json"); + string text = File.ReadAllText(@"GeneratorJsons/" + filename + ".json"); return JsonConvert.DeserializeObject(text) ?? Array.Empty(); } } \ No newline at end of file diff --git a/BingoForcing/UI/UI.cs b/BingoForcing/UI/UI.cs index 29efc39..4c32207 100644 --- a/BingoForcing/UI/UI.cs +++ b/BingoForcing/UI/UI.cs @@ -17,7 +17,7 @@ public static void Main() done = AwaitCommand(); } } - + private static bool AwaitCommand() { Console.WriteLine("\nAwaiting command, type help for list of commands, type quit to exit program"); @@ -80,7 +80,7 @@ private static void SetFileName(string arg) { filename = arg; } - if (!File.Exists(@"../../../GeneratorJsons/" + filename + ".json")) + if (!File.Exists(@"GeneratorJsons/" + filename + ".json")) { Console.WriteLine($"No generator was found at GeneratorJsons/{filename}\nPlease try again"); } @@ -98,7 +98,7 @@ private static void GenBoards() Console.WriteLine("No filename is currently selected, set use using SetFileName and then try again."); return; } - if (File.Exists(@"../../../BoardsFiles/" + _currentFilename + ".txt")) + if (File.Exists(@"BoardsFiles/" + _currentFilename + ".txt")) { Console.WriteLine($"Boards for {_currentFilename} have already been generated before, are you sure you want to do it again. Type Y to continue."); Console.Write("> ");