public static DataDictionary Load(string filename) { DataDictionaryReader ddr = new DataDictionaryReader(); ddr._filename = filename; using( ddr._tr = IO.CreateStreamReaderFromCSProFile(filename) ) { string line = null; string prevLineToHandle = null; while( ( prevLineToHandle != null ) || ( ( line = ddr.ReadTrimmedLine() ) != null ) ) { if( prevLineToHandle != null ) { line = prevLineToHandle; prevLineToHandle = null; } if( IsHeader(line) ) { // the loading functions return the last line read, which should be either null, a blank string, or a new section if( line.Equals(DataDictionaryElements.DICT_HEADER,StringComparison.InvariantCultureIgnoreCase) ) prevLineToHandle = ddr.LoadDictionary(); else if( line.Equals(DataDictionaryElements.DICT_LANGUAGES,StringComparison.InvariantCultureIgnoreCase) ) prevLineToHandle = ddr.LoadLanguages(); else if( line.Equals(DataDictionaryElements.DICT_LEVEL,StringComparison.InvariantCultureIgnoreCase) ) prevLineToHandle = ddr.LoadLevel(); else if( line.Equals(DataDictionaryElements.DICT_IDITEMS,StringComparison.InvariantCultureIgnoreCase) ) ddr._record = ddr._level.IDs; else if( line.Equals(DataDictionaryElements.DICT_RECORD,StringComparison.InvariantCultureIgnoreCase) ) prevLineToHandle = ddr.LoadRecord(); else if( line.Equals(DataDictionaryElements.DICT_ITEM,StringComparison.InvariantCultureIgnoreCase) ) prevLineToHandle = ddr.LoadItem(); else if( line.Equals(DataDictionaryElements.DICT_VALUESET,StringComparison.InvariantCultureIgnoreCase) ) prevLineToHandle = ddr.LoadValueSet(); else if( line.Equals(DataDictionaryElements.DICT_RELATION,StringComparison.InvariantCultureIgnoreCase) ) prevLineToHandle = ddr.LoadRelation(); else throw new DataDictionaryReaderException(line); } else // an unrecognized command throw new DataDictionaryReaderException(line); } return ddr._dictionary; } }