예제 #1
0
파일: FileIO.cs 프로젝트: TYR521/OpenShade
        public void LoadCustomTweaks(ObservableCollection <CustomTweak> customTweaks, IniFile pref, bool monitorChanges)
        {
            // TODO: Find a decent way to check if there are changes between the new loaded custom tweaks and the old ones

            customTweaks.Clear();
            int    count        = 0;
            string section      = "CUSTOM_TWEAK" + count.ToString();
            bool   customExists = pref.KeyExists("isActive", section);

            while (customExists)
            {
                var newTweak = new CustomTweak(section,
                                               pref.Read("Name", section),
                                               Path.GetFileName(pref.Read("Shader", section)), // to remove Post-Process// directory for HDR file
                                               int.Parse(pref.Read("Index", section)),
                                               pref.Read("OldPattern", section).FromHexString(),
                                               pref.Read("NewPattern", section).FromHexString(),
                                               pref.Read("IsActive", section) == "1" ? true : false);

                customTweaks.Add(newTweak);

                count++;
                section      = "CUSTOM_TWEAK" + count.ToString();
                customExists = pref.KeyExists("isActive", section);
            }
        }
예제 #2
0
        public static string GetDictHashCode(ObservableCollection <CustomTweak> effectList)
        {
            string hash = "";

            foreach (var entry in effectList)
            {
                CustomTweak effect = entry as CustomTweak;
                hash += effect.name;
                hash += effect.shaderFile;
                hash += effect.index.ToString();
                hash += effect.oldCode;
                hash += effect.newCode;
                hash += effect.isEnabled.ToString();
            }

            return(hash);
        }