IS_Lab2/IS_Lab2_XMLJson/Program.cs
purifetchi fbcfc5edc2 zad8
2025-03-10 00:16:46 +01:00

27 lines
No EOL
640 B
C#

using IS_Lab2_XMLJson;
if (args.Length != 3)
{
Console.WriteLine("Usage: <mode> <input file> <output file>");
Console.WriteLine("Modes: json-to-xml | xml-to-json");
return;
}
var mode = args[0];
var inputFile = args[1];
var outputFile = args[2];
switch (mode.ToLower())
{
case "json-to-xml":
XmlJsonConverter.JsonToXml(inputFile, outputFile);
break;
case "xml-to-json":
XmlJsonConverter.XmlToJson(inputFile, outputFile);
break;
default:
Console.WriteLine("Invalid mode. Use 'json-to-xml' or 'xml-to-json'.");
return;
}
Console.WriteLine("Conversion complete.");