static void PrintBasesAndVariants() { Log.Message("\nAvailable Bases:"); foreach (Base item in Enum.GetValues(typeof(Base))) { if (item == Base.None) { continue; } IBaseInfo info = BaseMap.GetInfo(item); if (info == null) { continue; } string arg = item.ToString().ToLowerInvariant(); Log.Message( " " + arg.PadTo(12) + info.DisplayName + " - " + info.Description ); } }
static void Main(string[] args) { if (args.Length < 1) { Options.Usage(); return; } else { if (!Options.Parse(args)) { return; } } ICodecIO dataIn = null; ICodecIO dataOut = null; var codecIn = BaseMap.GetInstance(Options.BaseIn); var codecOut = BaseMap.GetInstance(Options.BaseOut); if (codecIn == null || codecOut == null) { Log.Error("codec not available"); return; } try { if (Options.FileNameIn != null) { dataIn = new CodecIO(CodecIO.Mode.Read, Options.FileNameIn, codecIn); } else if (Options.DataFromArgs != null) { dataIn = new CodecIO(new StringReader(Options.DataFromArgs)); } else { dataIn = new CodecIO(Console.In); } if (Options.FileNameOut != null) { dataOut = new CodecIO(CodecIO.Mode.Write, Options.FileNameOut, codecOut); } else { dataOut = new CodecIO(Console.Out); } DoConversion(dataIn, dataOut, codecIn, codecOut); } finally { //We're only disposing if we opened a file if (dataIn != null) { dataIn.Dispose(); } if (dataOut != null) { dataOut.Dispose(); } } }