private static void Build(NCldrData ncldrData) { Progress("Writing data file", ncldrDataSource.NCldrDataFilename, ProgressEventType.Writing); try { ncldrDataSource.Save(ncldrData); } catch (SerializationException exception) { Console.WriteLine("Failed to serialize. Reason: " + exception.Message); throw; } }
public static void Build( string cldrPath, INCldrFileDataSource dataSource, NCldrBuilderProgressEventHandler progress = null, NCldrBuilderOptions options = null) { NCldrBuilder.options = options; NCldrBuilder.progress = progress; NCldrBuilder.cldrPath = cldrPath; NCldrBuilder.ncldrDataSource = dataSource; supplementalDataDocument = GetXmlDocument(@"common\supplemental\supplementalData.xml"); NCldrData ncldrData = new NCldrData(); ncldrData.CultureNames = GetCultureNames(); ncldrData.CultureDatas = GetCultures(); ncldrData.CalendarPreferences = GetCalendarPreferences(); ncldrData.CalendarTypes = GetCalendarTypes(); ncldrData.CharacterFallbacks = GetCharacterFallbacks(); ncldrData.Currencies = GetDescriptions <Currency>("currency", "cu", "currency"); ncldrData.CurrencyFractions = GetCurrencyFractions(); ncldrData.DayPeriodRuleSets = GetDayPeriodRuleSets(); ncldrData.GenderLists = GetGenderLists(); ncldrData.LanguageMatches = GetLanguageMatches(); ncldrData.LikelySubTags = GetLikelySubTags(); ncldrData.MeasurementData = GetMeasurementData(); ncldrData.MetaTimeZones = GetMetaTimeZones(); ncldrData.NumberingSystems = GetNumberingSystems(); ncldrData.OrdinalRuleSets = GetPluralRuleSets(true); ncldrData.ParentCultures = GetParentCultures(); ncldrData.PluralRuleSets = GetPluralRuleSets(false); ncldrData.PostcodeRegexes = GetPostcodeRegexes(); ncldrData.References = GetReferences(); ncldrData.RegionCodes = GetRegionCodes(); ncldrData.RegionGroups = GetRegionGroups(); ncldrData.RegionInformations = GetRegionInformations(); ncldrData.RegionTelephoneCodes = GetRegionTelephoneCodes(); ncldrData.TimeData = GetTimeData(); ncldrData.TimeZones = GetTimeZones(); ncldrData.WeekData = GetWeekData(); ncldrData.WindowsMetaTimeZones = GetWindowsMetaTimeZones(); Build(ncldrData); }
public static void Build( string cldrPath, INCldrFileDataSource dataSource, NCldrBuilderProgressEventHandler progress = null, NCldrBuilderOptions options = null) { NCldrBuilder.options = options; NCldrBuilder.progress = progress; NCldrBuilder.cldrPath = cldrPath; NCldrBuilder.ncldrDataSource = dataSource; supplementalDataDocument = GetXmlDocument(@"common\supplemental\supplementalData.xml"); NCldrData ncldrData = new NCldrData(); ncldrData.CultureNames = GetCultureNames(); ncldrData.CultureDatas = GetCultures(); ncldrData.CalendarPreferences = GetCalendarPreferences(); ncldrData.CalendarTypes = GetCalendarTypes(); ncldrData.CharacterFallbacks = GetCharacterFallbacks(); ncldrData.Currencies = GetDescriptions<Currency>("currency", "cu", "currency"); ncldrData.CurrencyFractions = GetCurrencyFractions(); ncldrData.DayPeriodRuleSets = GetDayPeriodRuleSets(); ncldrData.GenderLists = GetGenderLists(); ncldrData.LanguageMatches = GetLanguageMatches(); ncldrData.LikelySubTags = GetLikelySubTags(); ncldrData.MeasurementData = GetMeasurementData(); ncldrData.MetaTimeZones = GetMetaTimeZones(); ncldrData.NumberingSystems = GetNumberingSystems(); ncldrData.OrdinalRuleSets = GetPluralRuleSets(true); ncldrData.ParentCultures = GetParentCultures(); ncldrData.PluralRuleSets = GetPluralRuleSets(false); ncldrData.PostcodeRegexes = GetPostcodeRegexes(); ncldrData.References = GetReferences(); ncldrData.RegionCodes = GetRegionCodes(); ncldrData.RegionGroups = GetRegionGroups(); ncldrData.RegionInformations = GetRegionInformations(); ncldrData.RegionTelephoneCodes = GetRegionTelephoneCodes(); ncldrData.TimeData = GetTimeData(); ncldrData.TimeZones = GetTimeZones(); ncldrData.WeekData = GetWeekData(); ncldrData.WindowsMetaTimeZones = GetWindowsMetaTimeZones(); Build(ncldrData); }
private static void Build(NCldrData ncldrData) { string ncldrFile = Path.Combine(ncldrPath, "NCldr.dat"); Progress("Writing data file", ncldrFile, ProgressEventType.Writing); FileStream fileStream = new FileStream(ncldrFile, FileMode.Create); BinaryFormatter formatter = new BinaryFormatter(); try { formatter.Serialize(fileStream, ncldrData); } catch (SerializationException exception) { Console.WriteLine("Failed to serialize. Reason: " + exception.Message); throw; } finally { fileStream.Close(); } }