private void ConvertEGB2CSV() { if (_cmd.Args.Count != 2) { Console.WriteLine(@"Must specify a source and target."); return; } String sourceFile = _cmd.Args[0]; String targetFile = _cmd.Args[1]; AnalystFileFormat format1 = ConvertStringConst.String2AnalystFileFormat(_cmd.PromptString("format", "decpnt|comma")); CSVFormat format = ConvertStringConst.ConvertToCSVFormat(format1); new FileInfo(targetFile).Delete(); IDataSetCODEC codec = new CSVDataCODEC(targetFile, format, false); var loader = new BinaryDataLoader(codec) { Status = new ConsoleStatusReportable() }; _sw.Start(); loader.Binary2External(sourceFile); }
private void ConvertCSV2EGB() { if (_cmd.Args.Count != 2) { Console.WriteLine(@"Must specify a source and target."); return; } String sourceFile = _cmd.Args[0]; String targetFile = _cmd.Args[1]; bool headers = _cmd.PromptBoolean("headers", true); int inputCount = _cmd.PromptInteger("inputCount", 0); int outputCount = _cmd.PromptInteger("outputCount", 0); if (inputCount == 0) { Console.WriteLine(@"Must specify an input count."); return; } AnalystFileFormat format1 = ConvertStringConst.String2AnalystFileFormat(_cmd.PromptString("format", "decpnt|comma")); CSVFormat format = ConvertStringConst.ConvertToCSVFormat(format1); new FileInfo(targetFile).Delete(); IDataSetCODEC codec = new CSVDataCODEC(sourceFile, format, headers, inputCount, outputCount, false); var loader = new BinaryDataLoader(codec) { Status = new ConsoleStatusReportable() }; _sw.Start(); loader.External2Binary(targetFile); }
public void CreateInstanceOfTypeWithCtorParamsShouldThrowException() { Assert.Throws <MissingMethodException>( () => BinaryDataLoader.CreateAndLoad(typeof(ClassThatRequiresConstructorParameter), new BinaryReader(new MemoryStream()), new Version(0, 0))); }
public void LoadUnknownTypeShouldThrowException() { Assert.Throws <Exception>( () => BinaryDataLoader.CreateAndLoad(typeof(Vector2D), new BinaryReader(new MemoryStream()), new Version(0, 0))); }
public void LoadContentWithoutNameShouldThrowUnableToLoadContentDataWithoutName() { var stream = new MemoryStream(); var writer = new BinaryWriter(stream); writer.Write(true); writer.Write(string.Empty); ContentLoader.Use <MockContentLoader>(); stream.Position = 0; var reader = new BinaryReader(stream); var version = Assembly.GetExecutingAssembly().GetName().Version; Assert.That( () => BinaryDataLoader.CreateAndLoad(typeof(MockXmlContent), reader, version), Throws.Exception.With.InnerException.TypeOf <BinaryDataLoader.UnableToLoadContentDataWithoutName>()); ContentLoader.DisposeIfInitialized(); }