public bool Load(string fileFullName) { try { Log.Debug("Loading ConfigNode"); if (FileExists) { ConfigNode cnToLoad = GameDatabase.Instance.GetConfigNode(topNodeName); ConfigNode.LoadObjectFromConfig(this, cnToLoad); return(true); } else { Log.Now("File could not be found to load({0})", fileFullName); return(false); } } catch (Exception ex) { Log.Now("Failed to Load ConfigNode from file ({0}) - Error:{1}", fileFullName, ex.Message); Log.Now("Storing old config - {0}", fileFullName + ".err-" + timeNow); System.IO.File.Copy(fileFullName, fileFullName + ".err-" + timeNow, true); return(false); } }
public static bool RemoveSkin(string SkinID) { switch (SkinID) { case "Unity": case "KSP": Log.Now("RemoveSkin({0}) failed: removing a built-in skin is prohibited.", SkinID); return(false); default: Log.Now("RemoveSkin({0})", SkinID); return(knownSkins.Remove(SkinID)); } }
protected bool StopLooper() { try { Log.Debug("Cancelling the repeating function"); this.CancelInvoke("LooperWrapper"); _RepeatRunning = false; } catch (Exception) { Log.Now("Unable to cancel the repeating function"); } return(_RepeatRunning); }
protected bool StartLooper() { try { Log.Debug("Invoking the repeating function"); this.InvokeRepeating("LooperWrapper", _RepeatInitialWait, LooperRate); _RepeatRunning = true; } catch (Exception) { Log.Now("Unable to invoke the repeating function"); } return(_RepeatRunning); }
public static GUISkin CopySkin(string SkinID) { Log.Debug("in CopySkin(string SkinID)"); if (knownSkins.ContainsKey(SkinID)) { return((GUISkin)SCAN_MBE.Instantiate(knownSkins[SkinID])); } else { Log.Now("CopySkin(): GUISkin {0} not found", SkinID); throw new SystemException(string.Format("CopySkin(): GUISkin {0} not found", SkinID)); } }
public bool Save(string fileFullName) { try { ConfigNode cnToSave = AsConfigNode; ConfigNode cnSaveWrapper = new ConfigNode(GetType().Name); cnSaveWrapper.AddNode(cnToSave); cnSaveWrapper.Save(fileFullName); return(true); } catch (Exception ex) { Log.Now("Failed to Save ConfigNode to file({0})-Error:{1}", fileFullName, ex.Message); return(false); } }
internal static void AddStyle(GUIStyle NewStyle, ref GUISkin SkinToAction) { Log.Debug("in AddStyle(GUIStyle ns,ref GUISkin)"); if (string.IsNullOrEmpty(NewStyle.name)) { Log.Now("No Name Provided in the Style to add to {0}. Cannot add this.", SkinToAction.name); return; } List <GUIStyle> lstTemp = SkinToAction.customStyles.ToList <GUIStyle>(); // convert to a list if (lstTemp.Any(x => x.name == NewStyle.name)) { // add or edit the customstyle GUIStyle styleTemp = lstTemp.First(x => x.name == NewStyle.name); lstTemp.Remove(styleTemp); // if itexists then remove it first } lstTemp.Add(NewStyle); // add the new style SkinToAction.customStyles = lstTemp.ToArray <GUIStyle>(); // write the list back to the array }
public static void SetCurrent(string SkinID) { GUISkin OldSkin = _CurrentSkin; Log.Debug("Setting GUISkin(string SkinID) to {0}", SkinID); if (knownSkins.ContainsKey(SkinID)) { _CurrentSkin = knownSkins[SkinID]; } else { Log.Now("SetCurrent: GUISkin {0} not found", SkinID); } //SetCurrentTooltip(); // Now set the tooltip style as well if (OldSkin != CurrentSkin && OnSkinChanged != null) { OnSkinChanged(); } }