Skip to content

Commit 0eb429c

Browse files
committed
Saves are called again but now content is always null
1 parent e9f27ba commit 0eb429c

17 files changed

+23
-76
lines changed

Program.cs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,7 +1476,9 @@ public static void JSON()
14761476

14771477
// Read necessary config values
14781478
bool colorfulText = bool.Parse(configValues.ContainsKey("ColorfulText") ? configValues["ColorfulText"] : "true");
1479-
string saveFilePath = configValues.ContainsKey("SaveFilePath") ? configValues["SaveFilePath"] : "default_path.json";
1479+
string saveFilePath = configValues.ContainsKey("SaveFilePath") ? configValues["SaveFilePath"] : "jsons";
1480+
bool saveWithCustomNames = bool.Parse(configValues.ContainsKey("SaveSchemaWithCustomNames") ? configValues["SaveSchemaWithCustomNames"] : "true");
1481+
bool defaultCaseCorrection = bool.Parse(configValues.ContainsKey("DefaultCaseCorrection") ? configValues["DefaultCaseCorrection"] : "true");
14801482

14811483
// Show the menu
14821484
Console.Clear();
@@ -1500,6 +1502,7 @@ public static void JSON()
15001502
if (!string.IsNullOrEmpty(generatedJson))
15011503
{
15021504
jsonGenerated = true; // Set flag to true
1505+
JSON();
15031506
}
15041507
}
15051508
else if (choice2 == "Save JSON")
@@ -1510,7 +1513,8 @@ public static void JSON()
15101513
}
15111514
else
15121515
{
1513-
SaveJSON(generatedJson, saveFilePath, false, true); // Save the JSON
1516+
SaveJSON(generatedJson, saveFilePath, saveWithCustomNames, defaultCaseCorrection); // Save the JSON
1517+
JSON();
15141518
}
15151519
}
15161520
else if (choice2 == "Back")
@@ -1538,7 +1542,7 @@ public static void SaveJSON(string jsonContent, string saveFilePath, bool saveWi
15381542
string fileName = "output.json"; // Default file name
15391543

15401544
// If saveWithCustomNames is true, ask for the custom file name
1541-
if (saveWithCustomNames)
1545+
if (saveWithCustomNames == true)
15421546
{
15431547
Console.WriteLine("Enter the custom name for the JSON file (without extension): ");
15441548
string customFileName = Console.ReadLine().Trim();
@@ -1555,7 +1559,7 @@ public static void SaveJSON(string jsonContent, string saveFilePath, bool saveWi
15551559
}
15561560

15571561
// Apply case correction if enabled
1558-
if (defaultCaseCorrection)
1562+
if (defaultCaseCorrection == true)
15591563
{
15601564
jsonContent = ApplyCaseCorrection(jsonContent);
15611565
}
@@ -1571,10 +1575,13 @@ public static void SaveJSON(string jsonContent, string saveFilePath, bool saveWi
15711575
{
15721576
Console.WriteLine($"Error saving the JSON file: {ex.Message}");
15731577
}
1578+
1579+
int milliseconds = 2000;
1580+
Thread.Sleep(milliseconds);
1581+
15741582
JSON(); // After saving, return to the JSON menu
15751583
}
15761584

1577-
15781585
public static string MakeJSON(Dictionary<string, string> configValues)
15791586
{
15801587
// Read the "ColorfulText" option from configValues
@@ -1620,6 +1627,9 @@ public static string MakeJSON(Dictionary<string, string> configValues)
16201627
// Serialize to JSON (formatting with indents)
16211628
string jsonOutput = JsonConvert.SerializeObject(jsonData, Formatting.Indented);
16221629

1630+
int milliseconds = 2000;
1631+
Thread.Sleep(milliseconds);
1632+
16231633
// Return the generated JSON as a string instead of printing it
16241634
return jsonOutput;
16251635
}
@@ -1761,8 +1771,6 @@ private static bool ValidateNumber(Newtonsoft.Json.Linq.JObject attributes, doub
17611771
return true; // Value is valid
17621772
}
17631773

1764-
1765-
17661774
private static void AddValidationSyntax(Newtonsoft.Json.Linq.JObject attributes, int level)
17671775
{
17681776
var validationAttributes = new[] { "minimum", "maximum", "exclusiveMinimum", "exclusiveMaximum", "multipleOf", "enum", "minLength", "maxLength", "minItems", "maxItems", "uniqueItems" };
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
32 Bytes
Binary file not shown.

bin/Release/net8.0/config.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
PropertyDescriptions = true;
22
PropertySyntaxShown = true;
3-
ShowFieldTypeAsName = true;
3+
ShowFieldTypeAsName = false;
44
JsonExtentsionType = .json;
55
ColorfulText = true;
66
SaveFilePath[JSON] = jsons;
77
SaveFilePath[Schema] = schemas;
8-
SaveSchemaWithCustomNames = false;
8+
SaveSchemaWithCustomNames = true;
99
DefaultCaseCorrection = true;
1010
DescriptionsForSchemaProperties = true;
1111
SaveJSONSWithCustomNames = true;

bin/Release/net8.0/default/default_schema.json

Lines changed: 0 additions & 47 deletions
This file was deleted.

bin/Release/net8.0/default_path.json/output.json

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1 @@
1-
{
2-
"Rating": 5,
3-
"RatingContent": {
4-
"Rating Name": "Alright",
5-
"Description": [
6-
"The album is alright",
7-
"Needs some more variation though",
8-
"Try putting in some more dubstep or screams",
9-
"other than that, pretty solid",
10-
"Peace - Someone"
11-
],
12-
"Image Index": []
13-
}
14-
}
1+
null

bin/Release/net8.0/schemas/default_schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
"type": "array",
2929
"description": "Give me a description each string is a new line!",
3030
"items": { "type": "String" },
31-
"minItems": 50,
32-
"maxItems": 200,
31+
"minItems": 5,
32+
"maxItems": 20,
3333
"uniqueItems": true
3434
} ,
3535
"Image Index": {

obj/Release/net8.0/JSONMakerProjectConsoleApp.AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
[assembly: System.Reflection.AssemblyCompanyAttribute("JSONMakerProjectConsoleApp")]
1515
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
1616
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
17-
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+3bffe2f0492d42bdc7cf87c06715992313fad329")]
17+
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e9f27bad747cb4252266b6c8a9c90ce6f25e3cd4")]
1818
[assembly: System.Reflection.AssemblyProductAttribute("JSONMakerProjectConsoleApp")]
1919
[assembly: System.Reflection.AssemblyTitleAttribute("JSONMakerProjectConsoleApp")]
2020
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

0 commit comments

Comments
 (0)