//Init public static CmdArgs CmdLinePrase(string[] args) { CmdArgs cmdarg = new CmdArgs(); cmdarg.FirstArgs = args[0]; cmdarg.CommandArg = CommandLine.Parse(args); return cmdarg; }
/// <summary> /// working functions /// </summary> static void WriteDllWrapper(CmdArgs cmd) { string dllpath,pempath; try { dllpath = cmd.CommandArg.ArgPairs["writedll"]; pempath = cmd.CommandArg.ArgPairs["inkey"]; /* if (dllpath[0] == '"' && dllpath[dllpath.Length - 1] == '"') { dllpath = dllpath.Substring(1, dllpath.Length - 2); } if (pempath[0] == '"' && pempath[pempath.Length - 1] == '"') { pempath = pempath.Substring(1, pempath.Length - 2); } */ if (!File.Exists(dllpath)) { throw null; } else if (!File.Exists(pempath)) { Console.WriteLine(pempath); throw null; } } catch (Exception) { Console.WriteLine("Invaild Command or File Not Exist!"); return; } //if normal, run the actual function. WriteDll(dllpath, pempath); }