public GZip(string input, string output, IReader fileReader, IWriter fileWriter, IArchivator archivator, IPerfomanceCounter perfomance) { sourceFile = input; destinationFile = output; _fileReader = fileReader; _queueReader = _fileReader.GetQueue(); _readerEvent = _fileReader.GetResetEvent(); _fileWriter = fileWriter; _queueWriter = _fileWriter.GetQueue(); _writerEvent = _fileWriter.GetResetEvent(); _archivator = archivator; _perfomance = perfomance; }
static int Main(string[] args) { Console.WriteLine(Help()); try { args = Console.ReadLine().Split(' '); ArgsValidation(args); var discName = new string(args[2].Take(2).ToArray()); switch (args[0].ToLower()) { case "compress": reader = new FileReader(); writer = new FileWriter(); archivator = new Compressor(reader.GetQueue(), writer.GetQueue()); perfomance = new DiscPerfomanceCounter(discName); zipper = new WorkManager(args[1], args[2], reader, writer, archivator, perfomance); break; case "decompress": reader = new GZipReader(); writer = new GZipWriter(); archivator = new Decompressor(reader.GetQueue(), writer.GetQueue()); perfomance = new DiscPerfomanceCounter(discName); zipper = new WorkManager(args[1], args[2], reader, writer, archivator, perfomance); break; } reader.Reading += Progress; zipper.Launch(); Console.ReadKey(); return(zipper.CallBackResult()); } catch (Exception ex) { Console.WriteLine("Обнаружена ошибка!\n Метод: {0}\n Описание ошибки {1}", ex.TargetSite, ex.Message); Console.ReadKey(); return(0); } }
public WorkManager(string input, string output, IReader fileReader, IWriter fileWriter, IArchivator archivator, IPerfomanceCounter perfomance) : base(input, output, fileReader, fileWriter, archivator, perfomance) { }