Esempio n. 1
0
        public static bool GetModuleBool(IIgorModule Module, string BoolKey, bool bDefaultValue = false)
        {
            IgorConfig Inst = GetInstance();

            if (Inst != null)
            {
                string FullKey = BoolKey;

                if (Module != null)
                {
                    FullKey = Module.GetModuleName() + "." + FullKey;
                }

                foreach (IgorConfigKeyValuePair <string, bool> CurrentValue in Inst.ModuleBools)
                {
                    if (CurrentValue.Key == FullKey)
                    {
                        return(CurrentValue.Value);
                    }
                }

                return(bDefaultValue);
            }

            return(bDefaultValue);
        }
Esempio n. 2
0
        public static void SetModuleString(IIgorModule Module, string StringKey, string Value)
        {
            IgorConfig Inst = GetInstance();

            if (Inst != null)
            {
                string FullKey = StringKey;

                if (Module != null)
                {
                    FullKey = Module.GetModuleName() + "." + FullKey;
                }

                int CurrentIndex = 0;

                foreach (IgorConfigKeyValuePair <string, string> CurrentValue in Inst.ModuleStrings)
                {
                    if (CurrentValue.Key == FullKey)
                    {
                        Inst.ModuleStrings[CurrentIndex].Value = Value;

                        return;
                    }

                    ++CurrentIndex;
                }

                IgorConfigKeyValuePair <string, string> NewInst = new IgorConfigKeyValuePair <string, string>(FullKey, Value);

                Inst.ModuleStrings.Add(NewInst);
            }
        }
Esempio n. 3
0
        public virtual string GetParamOrConfigString(string StringKey, string EmptyStringWarningMessage = "", string DefaultValue = "", bool bCheckForEmpty = true)
        {
#if UNITY_EDITOR
            if (bIsDrawingInspector && EmptyStringWarningMessage != "")
            {
                LogError("Don't call this from within a DrawJobInspectorAndGetEnabledParams implementation!  This isn't accessing the right job config value since it hasn't been saved to disk yet.");
            }
#endif // UNITY_EDITOR

            string StringValue = DefaultValue;

            if (IgorJobConfig.IsStringParamSet(StringKey))
            {
                StringValue = IgorJobConfig.GetStringParam(StringKey);
            }
            else
            {
                StringValue = IgorConfig.GetModuleString(this, StringKey);
            }

            if (StringValue == DefaultValue && bCheckForEmpty && EmptyStringWarningMessage != "")
            {
                LogWarning(EmptyStringWarningMessage);
            }

            if (StringValue == "")
            {
                StringValue = DefaultValue;
            }

            return(StringValue);
        }
Esempio n. 4
0
        public static void CreateOrUpdateSavedJob(string JobName, IgorPersistentJobConfig JobConfig)
        {
            IgorConfig Inst = GetInstance();

            if (Inst != null)
            {
                int CurrentJobIndex = 0;

                foreach (IgorPersistentJobConfig CurrentJob in Inst.JobConfigs)
                {
                    if (CurrentJob.JobName == JobName)
                    {
                        Inst.JobConfigs[CurrentJobIndex] = JobConfig;

                        Inst.Save();

                        return;
                    }

                    ++CurrentJobIndex;
                }

                Inst.JobConfigs.Add(JobConfig);

                Inst.Save();
            }
        }
Esempio n. 5
0
        public static string GetModuleString(IIgorModule Module, string StringKey, string DefaultValue = "")
        {
            IgorConfig Inst = GetInstance();

            if (Inst != null)
            {
                string FullKey = StringKey;

                if (Module != null)
                {
                    FullKey = Module.GetModuleName() + "." + FullKey;
                }

                foreach (IgorConfigKeyValuePair <string, string> CurrentValue in Inst.ModuleStrings)
                {
                    if (CurrentValue.Key == FullKey)
                    {
                        return(CurrentValue.Value);
                    }
                }

                return(DefaultValue);
            }

            return(DefaultValue);
        }
Esempio n. 6
0
        public static void CheckForNamedJobFlag()
        {
            if (IgorJobConfig.IsStringParamSet(NamedJobFlag))
            {
                string JobToStart = IgorJobConfig.GetStringParam(NamedJobFlag);

                foreach (IgorPersistentJobConfig Job in IgorConfig.GetInstance().JobConfigs)
                {
                    if (Job.JobName == JobToStart)
                    {
                        IgorJobConfig ConfigInst = IgorJobConfig.GetConfig();

                        ConfigInst.Persistent = Job;

                        ConfigInst.Save(IgorJobConfig.IgorJobConfigPath);

                        IgorDebug.CoreLog("Starting named job " + JobToStart + ".");

                        return;
                    }
                }

                IgorDebug.CoreLogError("Couldn't find named job " + JobToStart + "!");
            }
        }
Esempio n. 7
0
        public static List <IgorPersistentJobConfig> GetAllJobs()
        {
            IgorConfig Inst = GetInstance();

            if (Inst != null)
            {
                return(Inst.JobConfigs);
            }

            return(null);
        }
Esempio n. 8
0
        public static IgorPersistentJobConfig GetJobByName(string JobName)
        {
            IgorConfig Inst = GetInstance();

            if (Inst != null)
            {
                foreach (IgorPersistentJobConfig CurrentJob in Inst.JobConfigs)
                {
                    if (CurrentJob.JobName == JobName)
                    {
                        return(CurrentJob);
                    }
                }
            }

            return(null);
        }
Esempio n. 9
0
        public static void CheckForAndRunJobs()
        {
            string JobName = Environment.GetEnvironmentVariable(MonsterTestCore.MonsterLauncherJobNameEnvVariable);

            MonsterDebug.Log("Checking for job " + JobName);

            if (JobName != null && JobName != "" && JobName != CurrentJobName)
            {
                IgorConfig.SetJobToRunByName(JobName);

                MonsterDebug.Log("Starting job " + JobName);

                CurrentJobName = JobName;
            }

            IgorCore.HandleJobStatus(IgorCore.RunJob(false));
        }
Esempio n. 10
0
        public static IgorConfig GetInstance()
        {
            if (Instance == null)
            {
                IgorCore.Initialize();
            }

            if (!File.Exists(DefaultConfigPath))
            {
                InitializeStartingConfig();
            }

            if (Instance == null)
            {
                Instance = Load(DefaultConfigPath);
            }

            return(Instance);
        }
Esempio n. 11
0
        public static void SetJobToRunByName(string JobName)
        {
            IgorConfig Inst = GetInstance();

            if (Inst != null)
            {
                foreach (IgorPersistentJobConfig CurrentJob in Inst.JobConfigs)
                {
                    if (CurrentJob.JobName == JobName)
                    {
                        IgorJobConfig NewConfig = new IgorJobConfig();

                        NewConfig.Persistent = CurrentJob;

                        NewConfig.Save(IgorJobConfig.IgorJobConfigPath);

                        IgorJobConfig.SetLastPriority(-1);
                        IgorJobConfig.SetLastIndexInPriority(-1);

                        return;
                    }
                }
            }
        }
Esempio n. 12
0
 public virtual void SetConfigBool(string BoolKey, bool bValue)
 {
     IgorConfig.SetModuleBool(this, BoolKey, bValue);
 }
Esempio n. 13
0
 public virtual bool GetConfigBool(string BoolKey, bool bDefaultValue = false)
 {
     return(IgorConfig.GetModuleBool(this, BoolKey, bDefaultValue));
 }
Esempio n. 14
0
 public virtual string GetConfigString(string StringKey, string DefaultValue = "")
 {
     return(IgorConfig.GetModuleString(this, StringKey, DefaultValue));
 }
Esempio n. 15
0
        public virtual void DrawStringConfigParamDifferentOverride(ref string CurrentParams, string StringLabel, string StringOverrideParam, string ConfigKey, string OverrideCurrentValue = null)
        {
            string CurrentStringValue = "";
            string CurrentConfigValue = IgorConfig.GetModuleString(this, ConfigKey);

            bool bDisplayConfigValue = false;

            if (OverrideCurrentValue == null)
            {
                if (IgorRuntimeUtils.IsStringParamSet(CurrentParams, StringOverrideParam))
                {
                    CurrentStringValue = IgorRuntimeUtils.GetStringParam(CurrentParams, StringOverrideParam);
                }
                else
                {
                    bDisplayConfigValue = true;
                }
            }
            else
            {
                if (CurrentConfigValue == OverrideCurrentValue)
                {
                    bDisplayConfigValue = true;
                }
                else
                {
                    CurrentStringValue = OverrideCurrentValue;
                }
            }

            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.LabelField(new GUIContent(StringLabel, StringLabel), GUILayout.MaxWidth(100.0f));

            EditorGUILayout.BeginHorizontal();

            string DisplayString = bDisplayConfigValue ? CurrentConfigValue : CurrentStringValue;

            GUIStyle TextFieldStyle = new GUIStyle(GUI.skin.textField);

            if (!bDisplayConfigValue)
            {
                TextFieldStyle.normal.background  = GetTextFieldBGGreenNormal();
                TextFieldStyle.focused.background = GetTextFieldBGGreenActive();
            }

            string NewStringValue = GUILayout.TextField(DisplayString, TextFieldStyle, GUILayout.ExpandWidth(true), GUILayout.MinWidth(100.0f));

            if (!NewStringValue.Contains("\"") && !(NewStringValue.Length == 1 && NewStringValue[0] == ' '))
            {
                CurrentStringValue = NewStringValue;
            }

            if (bDisplayConfigValue && CurrentStringValue == CurrentConfigValue)
            {
                CurrentStringValue = "";
            }

            GUIStyle ButtonStyle = new GUIStyle(GUI.skin.button);

            ButtonStyle.border = new RectOffset();
            ButtonStyle.margin = new RectOffset();

            if (GUILayout.Button(new GUIContent("<-", "Use the config value"), ButtonStyle, GUILayout.Width(25.0f)))
            {
                CurrentStringValue = "";
            }

            if (GUILayout.Button(new GUIContent("->", "Update the config value to the current value (This will change all other jobs that haven't overridden this value!)"), ButtonStyle, GUILayout.Width(25.0f)))
            {
                if (!bDisplayConfigValue)
                {
                    CurrentConfigValue = CurrentStringValue;
                }

                IgorConfig.SetModuleString(this, ConfigKey, CurrentConfigValue);
            }

            string ConfigLabel = CurrentConfigValue + " - From Global Config Key: " + GetModuleName() + "." + ConfigKey;
//			string ConfigLabel = "Global Config: \"" + CurrentConfigValue + "\" from Key: \"" + GetModuleName() + "." + ConfigKey + "\"";

            GUIStyle LabelFieldStyle = new GUIStyle(GUI.skin.label);

            LabelFieldStyle.alignment     = TextAnchor.MiddleLeft;
            LabelFieldStyle.border        = new RectOffset();
            LabelFieldStyle.contentOffset = new Vector2();
            LabelFieldStyle.margin        = new RectOffset();

            if (bDisplayConfigValue)
            {
                LabelFieldStyle.normal.background = GetLabelFieldBGGreen();
            }

            GUILayout.Label(new GUIContent(ConfigLabel, ConfigLabel), LabelFieldStyle, GUILayout.MinWidth(20.0f));

            if (GUILayout.Button(new GUIContent("X", "Clear the config value (This will change all other jobs that haven't overridden this value!)"), ButtonStyle, GUILayout.Width(25.0f)))
            {
                CurrentConfigValue = "";

                IgorConfig.SetModuleString(this, ConfigKey, CurrentConfigValue);
            }

            EditorGUILayout.EndHorizontal();

            EditorGUILayout.EndHorizontal();

            CurrentParams = IgorRuntimeUtils.SetStringParam(CurrentParams, StringOverrideParam, CurrentStringValue);
        }
Esempio n. 16
0
        public static void InitializeStartingConfig()
        {
            IgorConfig NewInst = new IgorConfig();

            NewInst.Save();
        }
Esempio n. 17
0
 public static List <string> StaticGetEnabledModuleNames()
 {
     return(IgorConfig.GetInstance().GetEnabledModuleNames());
 }
Esempio n. 18
0
 public virtual void SetConfigString(string StringKey, string Value)
 {
     IgorConfig.SetModuleString(this, StringKey, Value);
 }
Esempio n. 19
0
        public static IgorConfig ReGetInstance()
        {
            Instance = null;

            return(GetInstance());
        }