public static void Save(DataDictionary dictionary,string filename) { DataDictionaryWriter ddw = new DataDictionaryWriter(); ddw._filename = filename; using( ddw._tw = IO.CreateStreamWriterForCSProFile(filename,dictionary.Version) ) { // save the header ddw._tw.WriteLine(DataDictionaryElements.DICT_HEADER); ddw.SaveOption(DataDictionaryElements.HEADER_VERSION,String.Format(CultureInfo.InvariantCulture,"{0} {1:F1}", DataDictionaryElements.HEADER_VERSION_CSPRO,dictionary.Version)); ddw.SaveSharedComponents(dictionary); ddw.SaveOption(DataDictionaryElements.HEADER_RECSTART,dictionary.RecTypeStart); ddw.SaveOption(DataDictionaryElements.HEADER_RECLEN,dictionary.RecTypeLength); ddw.SaveOption(DataDictionaryElements.HEADER_POSITIONS, dictionary.RelativePositioning ? DataDictionaryElements.HEADER_RELATIVE : DataDictionaryElements.HEADER_ABSOLUTE); ddw.SaveOption(DataDictionaryElements.HEADER_ZEROFILL,dictionary.ZeroFillDefault); ddw.SaveOption(DataDictionaryElements.HEADER_DECCHAR,dictionary.DecimalCharDefault); if( dictionary.UsingValueSetImages ) ddw.SaveOption(DataDictionaryElements.HEADER_VALUESETIMAGES,dictionary.UsingValueSetImages); ddw.SaveLanguages(dictionary); foreach( Level level in dictionary.Levels ) ddw.SaveLevel(level); foreach( Relation relation in dictionary.Relations ) ddw.SaveRelation(relation); } }
public static void Save(DataDictionary dictionary, string filename) { DataDictionaryWriter ddw = new DataDictionaryWriter(); ddw._filename = filename; using (ddw._tw = IO.CreateStreamWriterForCSProFile(filename, dictionary.Version)) { // save the header ddw._tw.WriteLine(DataDictionaryElements.DICT_HEADER); ddw.SaveOption(DataDictionaryElements.HEADER_VERSION, String.Format(CultureInfo.InvariantCulture, "{0} {1:F1}", DataDictionaryElements.HEADER_VERSION_CSPRO, dictionary.Version)); ddw.SaveSharedComponents(dictionary); ddw.SaveOption(DataDictionaryElements.HEADER_RECSTART, dictionary.RecTypeStart); ddw.SaveOption(DataDictionaryElements.HEADER_RECLEN, dictionary.RecTypeLength); ddw.SaveOption(DataDictionaryElements.HEADER_POSITIONS, dictionary.RelativePositioning ? DataDictionaryElements.HEADER_RELATIVE : DataDictionaryElements.HEADER_ABSOLUTE); ddw.SaveOption(DataDictionaryElements.HEADER_ZEROFILL, dictionary.ZeroFillDefault); ddw.SaveOption(DataDictionaryElements.HEADER_DECCHAR, dictionary.DecimalCharDefault); if (dictionary.UsingValueSetImages) { ddw.SaveOption(DataDictionaryElements.HEADER_VALUESETIMAGES, dictionary.UsingValueSetImages); } ddw.SaveLanguages(dictionary); foreach (Level level in dictionary.Levels) { ddw.SaveLevel(level); } foreach (Relation relation in dictionary.Relations) { ddw.SaveRelation(relation); } } }