public Operator(ParameterWrap parameter) { Parameter = parameter; if (Parameter.IsZipSource) { sourceZip = Parameter.Source; } else { sourcePath = Parameter.Source; } if (Parameter.IsZipDestination) { destinationZip = Parameter.Destination; if (File.Exists(destinationZip)) File.Delete(destinationZip); destinationPath = GetRandomTempPath(); if (Directory.Exists(destinationPath)) Directory.Delete(destinationPath, true); } else { destinationPath = Parameter.Destination; if (Directory.Exists(destinationPath)) throw new Exception("Destination path is exists."); } }
private static void Main(string[] args) { message = new MessageWriter(); message.Flushed += MessageFlushed; var para = new ParameterWrap(args, message); if (!para.IsGood) Environment.Exit(1); var oper = new Operator(para); oper.Doit(); Console.ReadKey(); }