private static void _RunDiffTool(string[] args) { if (args.Count() < 4) { Console.WriteLine(">DfsUtils Diff infile.dfsu 0.9 outfile.dfsu"); throw new ArgumentException("Diff needs 3 arguments"); } var file1 = args[1]; var file2 = args[2]; var outfile = args[3]; var differ = new DfsDiff(); differ.Run(file1, file2, outfile); }
static void Main(string[] args) { if (args.Length == 0) { PrintUsage(); return; } string arg0 = args[0].ToLower(); // In honor of Microsoft Word and its super users, i.e. those using Word as their text-file-editor // Word dislikes the '-' or '\u002D' hyphen, and is more than happy to replace it with '–' ('\u2013') // '-' ('\u002D') is the standard hyphen character. These are other unicode hyphen characters string hyphenChars = "\u05be\u1806\u2010\u2011\u2012\u2013\u2014\u2015\u2053\u2212\uFE58\uFE63\uFF0D"; // Check if first character is one of the special hyphen characters, replace with standard hyphen. if (hyphenChars.IndexOf(arg0[0]) >= 0) { arg0 = "-" + arg0.Substring(1); } if (arg0.StartsWith("-debug")) { arg0 = arg0.Substring(6); System.Diagnostics.Debugger.Launch(); } // Remember to lowercase all case cases switch (arg0) { case "-dfsdiff": _currentToolUsage = DfsDiff.UsageCreateDiffFile; CheckArguments(arg0, args, 2, 3); DfsDiff.CreateDiffFile(args[1], args[2], ArgNull(args, 3)); break; case "-dfsmerge": _currentToolUsage = ExamplesMisc.UsageMergeDfsFileItems; CheckArguments(arg0, args, 2, 99); ExamplesMisc.MergeDfsFileItems(args[1], ArgList(args, 2)); break; case "-resample": _currentToolUsage = ExamplesDfs2.UsageResample; CheckArguments(arg0, args, 4); ExamplesDfs2.Resample(args[1], args[2], ArgInt(args, 3), ArgInt(args, 4)); break; case "-maxvelocityfield": _currentToolUsage = ExamplesDfs2.UsageMaxVelocityField; CheckArguments(arg0, args, 2); ExamplesDfs2.MaxVelocityField(args[1], args[2]); break; case "-dfsuextractlayer": _currentToolUsage = ExamplesDfsu.UsageExtractDfsu2DLayerFrom3D; CheckArguments(arg0, args, 3); ExamplesDfsu.ExtractDfsu2DLayerFrom3D(args[1], args[2], ArgInt(args, 3)); break; case "-dfsuextractsubarea": _currentToolUsage = ExamplesDfsu.UsageExtractSubareaDfsu2D; CheckArguments(arg0, args, 6); ExamplesDfsu.ExtractSubareaDfsu2D(args[1], args[2], ArgDouble(args, 3), ArgDouble(args, 4), ArgDouble(args, 5), ArgDouble(args, 6)); break; default: Console.Out.WriteLine(""); Console.Out.WriteLine("ERROR: Coult not recognize tool name: {0}", arg0); Console.Out.WriteLine(""); Console.Out.WriteLine("Run DHI.MikeCore.Util without arguments to see usage of all tools"); Environment.Exit(-2); break; } }