static void Main(string[] args) { Console.WriteLine("Введите адрес файла для кодировки"); string fileName = Console.ReadLine(); DateTime startEncode = DateTime.Now; Encoder encoder = new Encoder(fileName); encoder.Encode(); TimeSpan tsEncode = DateTime.Now - startEncode; DisplayCodeInformation(encoder); encoder.WriteToFile("myFile.bin"); DateTime startDecode = DateTime.Now; string decoderType = ConfigurationManager.AppSettings.Get("DecoderType"); IDecoder decoder = DecoderCreator.Create(encoder.CodeToChar, "myFile.bin", encoder.TextLength, decoderType); decoder.Decode(); TimeSpan tsDecode = DateTime.Now - startDecode; Console.WriteLine("Время выполнения кодировки/декодировки: " + tsEncode.ToString(@"ss\.ffff") + "/" + tsDecode.ToString(@"ss\.ffff")); decoder.SaveToText("text.txt", Encoding.GetEncoding(1251)); Console.ReadLine(); }
/// <summary> /// Register a new decoder /// </summary> /// <param name="extension">Extension of the deocder files, ie ".ogg"</param> /// <param name="creator">Creator function for the decoder</param> public void Register(string extension, DecoderCreator creator) { if (string.IsNullOrEmpty(extension)) { throw new ArgumentException("extension is null or empty"); } if (creator == null) { throw new ArgumentNullException("creator"); } Decoders.Add(extension, creator); }