コード例 #1
0
        private static bool ToggleModule(DOTweenUtilityWindowModules.ModuleInfo m, ref bool srcSetting)
        {
            if (!File.Exists(m.filePath))
            {
                return(false);
            }
            srcSetting = m.enabled;
            bool flag = false;

            DOTweenUtilityWindowModules._LinesToChange.Clear();
            string[] strArray = File.ReadAllLines(m.filePath);
            for (int index = 0; index < strArray.Length; ++index)
            {
                string str = strArray[index];
                if (str.EndsWith("MODULE_MARKER") && str.StartsWith("#if") && (m.enabled && str.Contains("false") || !m.enabled && str.Contains("true")))
                {
                    DOTweenUtilityWindowModules._LinesToChange.Add(index);
                }
            }
            if (DOTweenUtilityWindowModules._LinesToChange.Count > 0)
            {
                flag = true;
                using (StreamWriter streamWriter = new StreamWriter(m.filePath))
                {
                    for (int index = 0; index < strArray.Length; ++index)
                    {
                        string str = strArray[index];
                        if (DOTweenUtilityWindowModules._LinesToChange.Contains(index))
                        {
                            str = m.enabled ? str.Replace("false", "true") : str.Replace("true", "false");
                        }
                        streamWriter.WriteLine(str);
                    }
                }
                AssetDatabase.ImportAsset(EditorUtils.FullPathToADBPath(m.filePath), ImportAssetOptions.Default);
            }
            string marker = m.id + "_MARKER";

            for (int index = 0; index < DOTweenUtilityWindowModules._ModuleDependentFiles.Length; ++index)
            {
                if (DOTweenUtilityWindowModules.ToggleModuleInDependentFile(DOTweenUtilityWindowModules._ModuleDependentFiles[index], m.enabled, marker))
                {
                    flag = true;
                }
            }
            DOTweenUtilityWindowModules._LinesToChange.Clear();
            return(flag);
        }
コード例 #2
0
 private static void CheckAutoModuleSettings(bool applySettings, DOTweenUtilityWindowModules.ModuleInfo m, ref bool srcModuleEnabled)
 {
     if (m.enabled == srcModuleEnabled)
     {
         return;
     }
     if (applySettings)
     {
         m.enabled = srcModuleEnabled;
         DOTweenUtilityWindowModules.ToggleModule(m, ref srcModuleEnabled);
     }
     else
     {
         srcModuleEnabled = m.enabled;
         EditorUtility.SetDirty((Object)DOTweenUtilityWindowModules._src);
     }
 }
コード例 #3
0
 private static bool ModuleIsEnabled(DOTweenUtilityWindowModules.ModuleInfo m)
 {
     if (!File.Exists(m.filePath))
     {
         return(false);
     }
     using (StreamReader streamReader = new StreamReader(m.filePath))
     {
         for (string str = streamReader.ReadLine(); str != null; str = streamReader.ReadLine())
         {
             if (str.EndsWith("MODULE_MARKER") && str.StartsWith("#if"))
             {
                 return(str.Contains("true"));
             }
         }
     }
     return(true);
 }