@@ -1476,7 +1476,9 @@ public static void JSON()
1476
1476
1477
1477
// Read necessary config values
1478
1478
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" ) ;
1480
1482
1481
1483
// Show the menu
1482
1484
Console . Clear ( ) ;
@@ -1500,6 +1502,7 @@ public static void JSON()
1500
1502
if ( ! string . IsNullOrEmpty ( generatedJson ) )
1501
1503
{
1502
1504
jsonGenerated = true ; // Set flag to true
1505
+ JSON ( ) ;
1503
1506
}
1504
1507
}
1505
1508
else if ( choice2 == "Save JSON" )
@@ -1510,7 +1513,8 @@ public static void JSON()
1510
1513
}
1511
1514
else
1512
1515
{
1513
- SaveJSON ( generatedJson , saveFilePath , false , true ) ; // Save the JSON
1516
+ SaveJSON ( generatedJson , saveFilePath , saveWithCustomNames , defaultCaseCorrection ) ; // Save the JSON
1517
+ JSON ( ) ;
1514
1518
}
1515
1519
}
1516
1520
else if ( choice2 == "Back" )
@@ -1538,7 +1542,7 @@ public static void SaveJSON(string jsonContent, string saveFilePath, bool saveWi
1538
1542
string fileName = "output.json" ; // Default file name
1539
1543
1540
1544
// If saveWithCustomNames is true, ask for the custom file name
1541
- if ( saveWithCustomNames )
1545
+ if ( saveWithCustomNames == true )
1542
1546
{
1543
1547
Console . WriteLine ( "Enter the custom name for the JSON file (without extension): " ) ;
1544
1548
string customFileName = Console . ReadLine ( ) . Trim ( ) ;
@@ -1555,7 +1559,7 @@ public static void SaveJSON(string jsonContent, string saveFilePath, bool saveWi
1555
1559
}
1556
1560
1557
1561
// Apply case correction if enabled
1558
- if ( defaultCaseCorrection )
1562
+ if ( defaultCaseCorrection == true )
1559
1563
{
1560
1564
jsonContent = ApplyCaseCorrection ( jsonContent ) ;
1561
1565
}
@@ -1571,10 +1575,13 @@ public static void SaveJSON(string jsonContent, string saveFilePath, bool saveWi
1571
1575
{
1572
1576
Console . WriteLine ( $ "Error saving the JSON file: { ex . Message } ") ;
1573
1577
}
1578
+
1579
+ int milliseconds = 2000 ;
1580
+ Thread . Sleep ( milliseconds ) ;
1581
+
1574
1582
JSON ( ) ; // After saving, return to the JSON menu
1575
1583
}
1576
1584
1577
-
1578
1585
public static string MakeJSON ( Dictionary < string , string > configValues )
1579
1586
{
1580
1587
// Read the "ColorfulText" option from configValues
@@ -1620,6 +1627,9 @@ public static string MakeJSON(Dictionary<string, string> configValues)
1620
1627
// Serialize to JSON (formatting with indents)
1621
1628
string jsonOutput = JsonConvert . SerializeObject ( jsonData , Formatting . Indented ) ;
1622
1629
1630
+ int milliseconds = 2000 ;
1631
+ Thread . Sleep ( milliseconds ) ;
1632
+
1623
1633
// Return the generated JSON as a string instead of printing it
1624
1634
return jsonOutput ;
1625
1635
}
@@ -1761,8 +1771,6 @@ private static bool ValidateNumber(Newtonsoft.Json.Linq.JObject attributes, doub
1761
1771
return true ; // Value is valid
1762
1772
}
1763
1773
1764
-
1765
-
1766
1774
private static void AddValidationSyntax ( Newtonsoft . Json . Linq . JObject attributes , int level )
1767
1775
{
1768
1776
var validationAttributes = new [ ] { "minimum" , "maximum" , "exclusiveMinimum" , "exclusiveMaximum" , "multipleOf" , "enum" , "minLength" , "maxLength" , "minItems" , "maxItems" , "uniqueItems" } ;
0 commit comments