public static String PrintInterval(KACTime timeTemp, int Segments, KACTime.PrintTimeFormat TimeFormat) { switch (TimeFormat) { case PrintTimeFormat.TimeAsUT: return(timeTemp.UTString()); case PrintTimeFormat.KSPString: return(timeTemp.IntervalString(Segments)); case PrintTimeFormat.DateTimeString: return(timeTemp.IntervalDateTimeString(Segments)); default: return(timeTemp.IntervalString(Segments)); } }
public static String PrintDate(KACTime timeTemp, KACTime.PrintTimeFormat TimeFormat) { switch (TimeFormat) { case PrintTimeFormat.TimeAsUT: return(timeTemp.UTString()); case PrintTimeFormat.KSPString: return(timeTemp.DateString()); case PrintTimeFormat.DateTimeString: return(timeTemp.DateTimeString()); default: return(timeTemp.DateTimeString()); } }
public void Load() { try { KACWorker.DebugLogFormatted("Loading Config"); KSP.IO.PluginConfiguration configfile = KSP.IO.PluginConfiguration.CreateForType <KerbalAlarmClock>(); configfile.load(); this.DailyVersionCheck = configfile.GetValue("DailyUpdateCheck", true); try { this.VersionCheckDate_Attempt = DateTime.ParseExact(configfile.GetValue("VersionCheckDate_Attempt", ""), "yyyy-MM-dd", CultureInfo.CurrentCulture); } catch (Exception) { this.VersionCheckDate_Attempt = new DateTime(); } try { this.VersionCheckDate_Success = DateTime.ParseExact(configfile.GetValue("VersionCheckDate_Success", ""), "yyyy-MM-dd", CultureInfo.CurrentCulture); } catch (Exception) { this.VersionCheckDate_Success = new DateTime(); } this.VersionWeb = configfile.GetValue("VersionWeb", ""); this.WindowVisible = configfile.GetValue("WindowVisible", false); this.WindowMinimized = configfile.GetValue("WindowMinimized", false); this.WindowPos = configfile.GetValue <Rect>("WindowPos", new Rect(3, 55, 300, 45)); this.WindowVisible_SpaceCenter = configfile.GetValue("WindowVisible_SpaceCenter", false); this.WindowMinimized_SpaceCenter = configfile.GetValue("WindowMinimized_SpaceCenter", false); this.WindowPos_SpaceCenter = configfile.GetValue <Rect>("WindowPos_SpaceCenter", new Rect(3, 36, 300, 45)); this.WindowVisible_TrackingStation = configfile.GetValue("WindowVisible_TrackingStation", false); this.WindowMinimized_TrackingStation = configfile.GetValue("WindowMinimized_TrackingStation", false); this.WindowPos_TrackingStation = configfile.GetValue <Rect>("WindowPos_TrackingStation", new Rect(202, 45, 300, 45)); this.IconPos = configfile.GetValue <Rect>("IconPos", new Rect(152, 0, 32, 32)); this.IconPos.height = 32; this.IconPos.width = 32; this.IconPos_SpaceCenter = configfile.GetValue <Rect>("IconPos_SpaceCenter", new Rect(3, 3, 32, 32)); this.IconPos_SpaceCenter.height = 32; this.IconPos_TrackingStation.width = 32; this.IconPos_TrackingStation = configfile.GetValue <Rect>("IconPos_TrackingStation", new Rect(196, 0, 32, 32)); this.IconPos_TrackingStation.height = 32; this.IconPos_TrackingStation.width = 32; this.IconShow_SpaceCenter = configfile.GetValue("IconShow_SpaceCenter", true); this.IconShow_TrackingStation = configfile.GetValue("IconShow_TrackingStation", true); this.UseBlizzyToolbarIfAvailable = configfile.GetValue <Boolean>("UseBlizzyToolbarIfAvailable", true); this.WindowMinimizedType = (MiminalDisplayType)configfile.GetValue("WindowMinimizedType", 0); this.KSCUIBlockersEnabled = configfile.GetValue <Boolean>("UIBlockersEnabled", true); this.BehaviourChecksPerSec = configfile.GetValue("BehaviourChecksPerSec", 10); this.BehaviourChecksPerSec_Custom = configfile.GetValue("BehaviourChecksPerSecCustom", 40); this.BackupSaves = configfile.GetValue("BackupSaves", true); this.BackupSavesToKeep = configfile.GetValue("BackupSavesToKeep", 20); this.CancelFlightModeJumpOnBackupFailure = configfile.GetValue("CancelFlightModeJumpOnBackupFailure", false); this.AllowJumpFromViewOnly = configfile.GetValue("AllowJumpFromViewOnly", true); this.AllowJumpToAsteroid = configfile.GetValue("AllowJumpToAsteroid", false); this.AlarmListMaxAlarms = configfile.GetValue("AlarmListMaxAlarms", "10"); this.AlarmDefaultAction = configfile.GetValue <int>("AlarmDefaultAction", 1); this.AlarmDefaultMargin = configfile.GetValue <Double>("AlarmDefaultMargin", 60); this.AlarmPosition = configfile.GetValue <int>("AlarmPosition", 1); this.AlarmDeleteOnClose = configfile.GetValue("AlarmDeleteOnClose", false); this.ShowTooltips = configfile.GetValue("ShowTooltips", true); this.ShowEarthTime = configfile.GetValue("ShowEarthTime", false); this.HideOnPause = configfile.GetValue("HideOnPause", true); String strTimeFormat = configfile.GetValue("TimeFormat", "KSPString"); //KACWorker.DebugLogFormatted("{0}",strTimeFormat); this.TimeFormat = (KACTime.PrintTimeFormat)Enum.Parse(typeof(KACTime.PrintTimeFormat), strTimeFormat); //this.TimeFormat = configfile.GetValue<KACTime.PrintTimeFormat>("TimeFormat", KACTime.PrintTimeFormat.KSPString); //KACWorker.DebugLogFormatted("{0}",this.TimeFormat.ToString()); if (configfile.GetValue <bool>("TimeAsUT", false) == true) { KACWorker.DebugLogFormatted("Forcing New Format"); this.TimeFormat = KACTime.PrintTimeFormat.TimeAsUT; configfile.SetValue("TimeAsUT", false); configfile.SetValue("TimeFormat", Enum.GetName(typeof(KACTime.PrintTimeFormat), this.TimeFormat)); configfile.save(); } this.AlarmXferRecalc = configfile.GetValue("AlarmXferRecalc", true); this.AlarmXferRecalcThreshold = configfile.GetValue <Double>("AlarmXferRecalcThreshold", 180); this.AlarmXferDisplayList = configfile.GetValue("AlarmXferDisplayList", false); this.XferUseModelData = configfile.GetValue("XferUseModelData", false); this.AlarmNodeRecalc = configfile.GetValue("AlarmNodeRecalc", false); this.AlarmNodeRecalcThreshold = configfile.GetValue <Double>("AlarmNodeRecalcThreshold", 180); this.AlarmAddSOIAuto = configfile.GetValue("AlarmAddSOIAuto", false); this.AlarmAddSOIAutoThreshold = configfile.GetValue <Double>("AlarmAddSOIAutoThreshold", 180); //this.AlarmAddSOIMargin = configfile.GetValue("AlarmAddSOIMargin", 120); this.AlarmAutoSOIMargin = configfile.GetValue <Double>("AlarmAutoSOIMargin", 900); this.AlarmAddSOIAuto_ExcludeEVA = configfile.GetValue("AlarmAddSOIAuto_ExcludeEVA", true); this.AlarmCatchSOIChange = configfile.GetValue("AlarmOnSOIChange", false); this.AlarmOnSOIChange_Action = configfile.GetValue("AlarmOnSOIChange_Action", 1); this.AlarmSOIRecalc = configfile.GetValue("AlarmSOIRecalc", false); this.AlarmSOIRecalcThreshold = configfile.GetValue <Double>("AlarmSOIRecalcThreshold", 180); this.AlarmAddManAuto = configfile.GetValue("AlarmAddManAuto", false); this.AlarmAddManAuto_andRemove = configfile.GetValue("AlarmAddManAuto_andRemove", false); this.AlarmAddManAutoThreshold = configfile.GetValue <Double>("AlarmAddManAutoThreshold", 180); this.AlarmAddManAutoMargin = configfile.GetValue <Double>("AlarmAddManAutoMargin", 180); this.AlarmAddManAuto_Action = configfile.GetValue("AlarmAddManAuto_Action", 1); this.AlarmCrewDefaultStoreNode = configfile.GetValue("AlarmCrewDefaultStoreNode", false); this.LoadManNode = configfile.GetValue("LoadManNode", ""); this.LoadVesselTarget = configfile.GetValue("LoadVesselTarget", ""); if (KSP.IO.File.Exists <KerbalAlarmClock>(String.Format("Alarms-{0}.txt", HighLogic.CurrentGame.Title))) { KACWorker.DebugLogFormatted("Trying New Alarms file..."); LoadAlarms(); } else { //Loop through numbers to Load Alarms Alarms = new KACAlarmList(); int intAlarm = 0; String strAlarm = ""; do { strAlarm = configfile.GetValue("Alarm_" + intAlarm, ""); KACWorker.DebugLogFormatted(strAlarm); if (strAlarm != "") { KACAlarm tmpAlarm = new KACAlarm(); tmpAlarm.LoadFromString(strAlarm); Alarms.Add(tmpAlarm); intAlarm++; } } while (strAlarm != ""); } KACWorker.DebugLogFormatted("Config Loaded Successfully"); } catch (Exception ex) { KACWorker.DebugLogFormatted("Failed To Load Config"); KACWorker.DebugLogFormatted(ex.Message); } }
public static String PrintInterval(KACTime timeTemp, KACTime.PrintTimeFormat TimeFormat) { return(PrintInterval(timeTemp, 3, TimeFormat)); }