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); }
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); } }
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); }
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(); } }
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); }
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 + "!"); } }
public static List <IgorPersistentJobConfig> GetAllJobs() { IgorConfig Inst = GetInstance(); if (Inst != null) { return(Inst.JobConfigs); } return(null); }
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); }
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)); }
public static IgorConfig GetInstance() { if (Instance == null) { IgorCore.Initialize(); } if (!File.Exists(DefaultConfigPath)) { InitializeStartingConfig(); } if (Instance == null) { Instance = Load(DefaultConfigPath); } return(Instance); }
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; } } } }
public virtual void SetConfigBool(string BoolKey, bool bValue) { IgorConfig.SetModuleBool(this, BoolKey, bValue); }
public virtual bool GetConfigBool(string BoolKey, bool bDefaultValue = false) { return(IgorConfig.GetModuleBool(this, BoolKey, bDefaultValue)); }
public virtual string GetConfigString(string StringKey, string DefaultValue = "") { return(IgorConfig.GetModuleString(this, StringKey, DefaultValue)); }
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); }
public static void InitializeStartingConfig() { IgorConfig NewInst = new IgorConfig(); NewInst.Save(); }
public static List <string> StaticGetEnabledModuleNames() { return(IgorConfig.GetInstance().GetEnabledModuleNames()); }
public virtual void SetConfigString(string StringKey, string Value) { IgorConfig.SetModuleString(this, StringKey, Value); }
public static IgorConfig ReGetInstance() { Instance = null; return(GetInstance()); }