Exemple #1
0
        public static StoreSetting ReadSetting(string SettingFile)
        {
            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));
            }
            return(null);
        }
Exemple #2
0
 public static bool IsSettingChange <TValue>(string SettingFile, ObjectStoreParameters para)
 {
     if (File.Exists(SettingFile))
     {
         var allbytes = File.ReadAllBytes(SettingFile);
         Kooboo.IndexedDB.Serializer.Simple.SimpleConverter <StoreSetting> converter = new Serializer.Simple.SimpleConverter <StoreSetting>();
         var oldsetting = converter.FromBytes(allbytes);
         var newsetting = GetSetting <TValue>(para);
         if (!IsSameSetting(oldsetting, newsetting))
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #3
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);
            }
        }