public static void UpdateSetting(string SettingFile, StoreSetting setting) { Kooboo.IndexedDB.Serializer.Simple.SimpleConverter <StoreSetting> converter = new Serializer.Simple.SimpleConverter <StoreSetting>(); var allbytes = converter.ToBytes(setting); File.WriteAllBytes(SettingFile, allbytes); }
public static StoreSetting GetOrSetSetting <TValue, TKey>(string SettingFile, ObjectStoreParameters para) { Kooboo.IndexedDB.Serializer.Simple.SimpleConverter <StoreSetting> converter = new Serializer.Simple.SimpleConverter <StoreSetting>(); if (File.Exists(SettingFile)) { var allbytes = File.ReadAllBytes(SettingFile); return(converter.FromBytes(allbytes)); } else { var setting = GetSetting <TValue>(para); var allbytes = converter.ToBytes(setting); File.WriteAllBytes(SettingFile, allbytes); return(setting); } }