示例#1
0
        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);
        }
示例#2
0
        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);
            }
        }