Skip to content

Commit

Permalink
Fix file paths
Browse files Browse the repository at this point in the history
  • Loading branch information
cirion02 committed Mar 25, 2023
1 parent 0ab6fd9 commit e44fd6b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion BingoForcing/BoardGeneration/BoardsFileGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
{
Expand Down
4 changes: 2 additions & 2 deletions BingoForcing/DataGathering/ObjectiveCounts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<char, string>[] result = new Dictionary<char, string>[25];

Expand All @@ -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<char, string>[] ReadLetterToObjectiveJson(string filename)
{
string text = File.ReadAllText(@"../../../GeneratorLookups/" + filename + ".json");
string text = File.ReadAllText(@"GeneratorLookups/" + filename + ".json");
return JsonConvert.DeserializeObject<Dictionary<char, string>[]>(text) ?? Array.Empty<Dictionary<char, string>>();
}
}
2 changes: 1 addition & 1 deletion BingoForcing/JsonParsers/GeneratorJsonParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Objective[][]>(text) ?? Array.Empty<Objective[]>();
}
}
6 changes: 3 additions & 3 deletions BingoForcing/UI/UI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
}
Expand All @@ -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("> ");
Expand Down

0 comments on commit e44fd6b

Please sign in to comment.