public static void CreateODC(string fileName, string xmlTemplate, string dataDirectory) { XmlSerializer deserializer = new XmlSerializer(typeof(CacheGenerationInfo)); TextReader textReader = new StreamReader(xmlTemplate); CacheGenerationInfo info = (CacheGenerationInfo)deserializer.Deserialize(textReader); textReader.Close(); ODCCreator odcCreator = new ODCCreator(info.HighestZone, info.Types, info.Times, info.Gap); foreach (var dimensionInfo in info.CacheInfo) { string fname = Path.Combine(dataDirectory, dimensionInfo.FileName); if (dimensionInfo.Is311) { odcCreator.LoadEMME2(fname, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex); } else { if (dimensionInfo.SaveInTimes) { odcCreator.LoadCSVTimes(fname, dimensionInfo.Header, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex); } else { odcCreator.LoadCSVTypes(fname, dimensionInfo.Header, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex); } } } odcCreator.Save(fileName, false); }
public void ReGenerate(string dataDirectory, string outputDirectory) { string fileName = Path.GetFileNameWithoutExtension(this.FileName); string path = Path.GetDirectoryName(this.FileName); string xmlFile = Path.Combine(path, fileName + ".xml"); XmlSerializer deserializer = new XmlSerializer(typeof(CacheGenerationInfo)); TextReader textReader = new StreamReader(xmlFile); CacheGenerationInfo info = (CacheGenerationInfo)deserializer.Deserialize(textReader); textReader.Close(); ODCCreator odcCreator = new ODCCreator(this.HighestZone, this.Types, this.Times, this.Indexes.Length); foreach (var dimensionInfo in info.CacheInfo) { string fname = Path.Combine(dataDirectory, dimensionInfo.FileName); if (dimensionInfo.Is311) { odcCreator.LoadEMME2(fname, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex); } else { if (dimensionInfo.SaveInTimes) { odcCreator.LoadCSVTimes(fname, dimensionInfo.Header, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex); } else { odcCreator.LoadCSVTypes(fname, dimensionInfo.Header, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex); } } } odcCreator.Save(Path.Combine(outputDirectory, Path.GetFileName(this.FileName)), true); }
public void ReGenerate(string dataDirectory, string outputDirectory) { string fileName = Path.GetFileNameWithoutExtension( this.FileName ); string path = Path.GetDirectoryName( this.FileName ); string xmlFile = Path.Combine( path, fileName + ".xml" ); XmlSerializer deserializer = new XmlSerializer( typeof( CacheGenerationInfo ) ); TextReader textReader = new StreamReader( xmlFile ); CacheGenerationInfo info = (CacheGenerationInfo)deserializer.Deserialize( textReader ); textReader.Close(); ODCCreator odcCreator = new ODCCreator( this.HighestZone, this.Types, this.Times, this.Indexes.Length ); foreach ( var dimensionInfo in info.CacheInfo ) { string fname = Path.Combine( dataDirectory, dimensionInfo.FileName ); if ( dimensionInfo.Is311 ) { odcCreator.LoadEMME2( fname, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex ); } else { if ( dimensionInfo.SaveInTimes ) { odcCreator.LoadCSVTimes( fname, dimensionInfo.Header, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex ); } else { odcCreator.LoadCSVTypes( fname, dimensionInfo.Header, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex ); } } } odcCreator.Save( Path.Combine( outputDirectory, Path.GetFileName( this.FileName ) ), true ); }
public static void CreateODC(string fileName, string xmlTemplate, string dataDirectory) { XmlSerializer deserializer = new XmlSerializer( typeof( CacheGenerationInfo ) ); TextReader textReader = new StreamReader( xmlTemplate ); CacheGenerationInfo info = (CacheGenerationInfo)deserializer.Deserialize( textReader ); textReader.Close(); ODCCreator odcCreator = new ODCCreator( info.HighestZone, info.Types, info.Times, info.Gap ); foreach ( var dimensionInfo in info.CacheInfo ) { string fname = Path.Combine( dataDirectory, dimensionInfo.FileName ); if ( dimensionInfo.Is311 ) { odcCreator.LoadEMME2( fname, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex ); } else { if ( dimensionInfo.SaveInTimes ) { odcCreator.LoadCSVTimes( fname, dimensionInfo.Header, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex ); } else { odcCreator.LoadCSVTypes( fname, dimensionInfo.Header, dimensionInfo.TimeIndex, dimensionInfo.TypeIndex ); } } } odcCreator.Save( fileName, false ); }