You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.0 KiB
C#

1 month ago
using System;
using System.IO;
using System.Linq;
namespace DeepNestConsole
{
class Program
{
static void ShowUsage()
{
Console.WriteLine("deepnest console tool. usage:");
Console.WriteLine("Runing sample:");
Console.WriteLine("deepNestConsole sample");
Console.WriteLine("");
Console.WriteLine("Runing nesting from xml plan:");
Console.WriteLine("deepNestConsole xml [xml]");
}
static void Main(string[] args)
{
if (args.Count() < 1)
{
ShowUsage();
return;
}
var type = args[0];
SampleProgram sample = new SampleProgram();
switch (type)
{
case "xml":
{
if (args.Count() < 2)
{
Console.WriteLine("wrong format");
return;
}
if (!File.Exists(args[1]))
{
Console.WriteLine("xml file not exist.");
return;
}
try
{
sample.Context.LoadXml(args[1]);
}
catch (Exception ex)
{
Console.WriteLine("Error loading xml file: " + ex.Message);
return;
}
}
break;
case "sample":
{
sample.Context.LoadSampleData();
}
break;
default:
{
Console.WriteLine("wrong format");
ShowUsage();
return;
}
}
sample.Run();
}
}
}