public static void CheckPrimarySplitterControlSettings(string defaultname) { string primarycontrolname = EDDProfiles.Instance.UserControlsPrefix + "SplitterControlWindows"; // primary name for first splitter string splitctrl = SQLiteConnectionUser.GetSettingString(primarycontrolname, ""); if (splitctrl == "" || !splitctrl.Contains("'0,1006'")) // never set, or wiped, or does not have TG in it, reset.. if previous system had the IDs, use them, else use defaults { int enum_bottom = SQLiteDBClass.GetSettingInt(defaultname + "BottomTab", (int)(PanelInformation.PanelIDs.Scan)); int enum_bottomright = SQLiteDBClass.GetSettingInt(defaultname + "BottomRightTab", (int)(PanelInformation.PanelIDs.Log)); int enum_middleright = SQLiteDBClass.GetSettingInt(defaultname + "MiddleRightTab", (int)(PanelInformation.PanelIDs.StarDistance)); int enum_topright = SQLiteDBClass.GetSettingInt(defaultname + "TopRightTab", (int)(PanelInformation.PanelIDs.SystemInformation)); string ctrl = "V(0.75, H(0.6, U'0,1006',U'1," + enum_bottom.ToStringInvariant() + "')," + "H(0.5, U'2," + enum_topright.ToStringInvariant() + "', " + "H(0.25,U'3," + enum_middleright.ToStringInvariant() + "',U'4," + enum_bottomright + "')) )"; SQLiteConnectionUser.PutSettingString(primarycontrolname, ctrl); } }
public override void Closing() { DGVSaveColumnLayout(dataGridViewCombat, DbColumnSave); discoveryform.OnNewEntry -= Discoveryform_OnNewEntry; discoveryform.OnHistoryChange -= Discoveryform_OnHistoryChange; transparentfont?.Dispose(); string s = ""; foreach (FilterEntry f in savedfilterentries) { s += f.Type.ToString() + "," + f.Name.QuoteString(comma: true) + "," + f.TargetFaction.QuoteString(comma: true) + "," + f.StartTime.ToStringZulu() + "," + f.EndTime.ToStringZulu() + ","; } SQLiteConnectionUser.PutSettingString(DbSave + "Campaign", s); SQLiteConnectionUser.PutSettingBool(DbSave + "Gridshow", checkBoxCustomGridOn.Checked); SQLiteConnectionUser.PutSettingString(DbSave + "Selected", current?.UniqueID ?? ""); }
public void CloseTabList() { List <int> idlist = new List <int>(); idlist.Add(SelectedIndex); // first is current index string tabnames = ""; foreach (TabPage p in TabPages) // all main tabs, load/display { UserControls.UserControlCommonBase uccb = p.Controls[0] as UserControls.UserControlCommonBase; uccb.Closing(); PanelInformation.PanelInfo pi = PanelInformation.GetPanelInfoByType(uccb.GetType()); idlist.Add(pi != null ? (int)pi.PopoutID : -1); idlist.Add(uccb.displaynumber); tabnames += p.Text + ";"; } SQLiteConnectionUser.PutSettingString("MajorTabControlList", string.Join(",", idlist)); SQLiteConnectionUser.PutSettingString("MajorTabControlName", tabnames); }
private bool EditActionFile(string name) // edit pack name { List <string> jevents = JournalEntry.GetListOfEventsWithOptMethod(towords: false); jevents.Sort(); List <ActionEvent> eventlist = ActionEventEDList.EventsFromNames(jevents, "Journal"); eventlist.AddRange(ActionEventEDList.events); // our ED events eventlist.AddRange(ActionEvent.events); // core events ActionPackEditorForm frm = new ActionPackEditorForm(); frm.AdditionalNames += Frm_onAdditionalNames; frm.CreateActionPackEdit += SetPackEditorAndCondition; ActionFile f = actionfiles.Get(name); if (f != null) { string collapsestate = SQLiteConnectionUser.GetSettingString("ActionEditorCollapseState_" + name, ""); // get any collapsed state info for this pack frm.Init("Edit pack " + name, this.Icon, this, AppFolder, f, eventlist, collapsestate); frm.ShowDialog(discoveryform); // don't care about the result, the form does all the saving SQLiteConnectionUser.PutSettingString("ActionEditorCollapseState_" + name, frm.CollapsedState()); // get any collapsed state info for this pack ActionConfigureKeys(); VoiceLoadEvents(); lasteditedpack = name; SQLiteConnectionUser.PutSettingString("ActionPackLastFile", lasteditedpack); return(true); } else { return(false); } }
public void CloseTabList() { List <int> idlist = new List <int>(); idlist.Add(SelectedIndex); // first is current index string tabnames = ""; UserControls.UserControlContainerSplitter primary = PrimaryTab; foreach (TabPage p in TabPages) // all main tabs, load/display { UserControls.UserControlCommonBase uccb = p.Controls[0] as UserControls.UserControlCommonBase; uccb.CloseDown(); PanelInformation.PanelInfo pi = PanelInformation.GetPanelInfoByType(uccb.GetType()); idlist.Add(Object.ReferenceEquals(uccb, primary) ? -1 : (int)pi.PopoutID); // primary is marked -1 idlist.Add(uccb.displaynumber); tabnames += p.Text + ";"; } SQLiteConnectionUser.PutSettingString(EDDProfiles.Instance.UserControlsPrefix + "MajorTabControlList", string.Join(",", idlist)); SQLiteConnectionUser.PutSettingString(EDDProfiles.Instance.UserControlsPrefix + "MajorTabControlName", tabnames); }
protected override bool VerifyFileAccess(string file, FileMode fm) { if (fm != FileMode.Open) { string folder = Path.GetDirectoryName(file); string actionfolderperms = SQLiteConnectionUser.GetSettingString("ActionFolderPerms", ""); if (!actionfolderperms.Contains(folder + ";")) { bool ok = ExtendedControls.MessageBoxTheme.Show("Warning - This programy is attempting to write to folder" + Environment.NewLine + Environment.NewLine + folder + Environment.NewLine + Environment.NewLine + "with file " + Path.GetFileName(file) + Environment.NewLine + Environment.NewLine + "!!! Verify you are happy for the program to write to ANY files in that folder!!!", "WARNING - WRITE FILE ACCESS REQUESTED", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes; if (ok) { SQLiteConnectionUser.PutSettingString("ActionFolderPerms", actionfolderperms + folder + ";"); return(true); } else { return(false); } } else { return(true); } } else { return(true); } }
public override void Closing() { //System.Diagnostics.Debug.WriteLine("Closing splitter " + displaynumber); PanelInformation.PanelIDs[] pids = PanelInformation.GetUserSelectablePanelIDs(TabListSortAlpha); SplitContainer sc = (SplitContainer)panelPlayfield.Controls[0]; string state = ControlHelpersStaticFunc.SplitterTreeState(sc, "", (c) => // S is either a TabStrip, or a direct UCCB. See the { ExtendedControls.TabStrip ts = c as ExtendedControls.TabStrip; int tagid = (int)c.Tag; if (ts != null) // if tab strip.. { return(tagid.ToStringInvariant() + "," + (ts.SelectedIndex >= 0 ? (int)pids[ts.SelectedIndex] : NoTabPanelSelected).ToStringInvariant()); } else { PanelInformation.PanelInfo pi = PanelInformation.GetPanelInfoByType(c.GetType()); // must return, as it must be one of the UCCB types return(tagid.ToStringInvariant() + "," + (FixedPanelOffset + ((int)pi.PopoutID)).ToStringInvariant()); } }); //System.Diagnostics.Debug.WriteLine("Split save " + state); SQLiteConnectionUser.PutSettingString(DbWindows, state); (panelPlayfield.Controls[0] as SplitContainer).RunActionOnSplitterTree((p, c) => // runs on each split panel node exactly.. { UserControlCommonBase uccb = ((c is ExtendedControls.TabStrip) ? ((c as ExtendedControls.TabStrip).CurrentControl) : c) as UserControlCommonBase; if (uccb != null) // tab strip may not have a control set.. { uccb.CloseDown(); //System.Diagnostics.Debug.WriteLine("Closing " + c.Name + " " + c.GetType().Name + " " + uccb.Name); } }); }
/// <summary> /// Saves the paths to the database and to UserPaths.json /// </summary> /// <param name="conn">Optional connection with which to save to the database</param> public void Save(SQLiteConnectionUser conn = null) { SQLiteConnectionUser.PutSettingString("EDDirectory", EDDirectory, conn); SQLiteConnectionUser.PutSettingString("ImageHandlerOutputDir", ImageHandlerOutputDir, conn); SQLiteConnectionUser.PutSettingString("ImageHandlerScreenshotsDir", ImageHandlerScreenshotsDir, conn); JObject jo = new JObject(); jo["EDDirectory"] = EDDirectory; if (!string.IsNullOrEmpty(ImageHandlerOutputDir)) { jo["ImageHandlerOutputDir"] = ImageHandlerOutputDir; } if (!string.IsNullOrEmpty(ImageHandlerScreenshotsDir)) { jo["ImageHandlerScreenshotsDir"] = ImageHandlerScreenshotsDir; } using (FileStream stream = File.OpenWrite(Path.Combine(EDDOptions.Instance.AppDataDirectory, "UserPaths.json.tmp"))) { using (StreamWriter writer = new StreamWriter(stream)) { using (JsonTextWriter jwriter = new JsonTextWriter(writer)) { jo.WriteTo(jwriter); } } } File.Delete(Path.Combine(EDDOptions.Instance.AppDataDirectory, "UserPaths.json")); File.Move(Path.Combine(EDDOptions.Instance.AppDataDirectory, "UserPaths.json.tmp"), Path.Combine(EDDOptions.Instance.AppDataDirectory, "UserPaths.json")); }
public override void Closing() { DGVSaveColumnLayout(dataGridViewEDSM, DbColumnSave); SQLiteConnectionUser.PutSettingString(DbRadius, textBoxRadius.Text.InvariantParseDoubleNull() != null ? textBoxRadius.Text : "20"); SQLiteConnectionUser.PutSettingString(DbStar, textBoxSystemName.Text); }
private void buttonExtImport_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.InitialDirectory = SQLiteConnectionUser.GetSettingString("BookmarkFormImportExcelFolder", "c:\\"); if (!System.IO.Directory.Exists(dlg.InitialDirectory)) { System.IO.Directory.CreateDirectory(dlg.InitialDirectory); } dlg.DefaultExt = "csv"; dlg.AddExtension = true; dlg.Filter = "CVS Files (*.csv)|*.csv|All files (*.*)|*.*"; if (dlg.ShowDialog(this) == DialogResult.OK) { string path = dlg.FileName; BaseUtils.CSVFile csv = new BaseUtils.CSVFile(); if (csv.Read(path, System.IO.FileShare.ReadWrite)) { List <BaseUtils.CSVFile.Row> rows = csv.RowsExcludingHeaderRow; BookmarkClass currentbk = null; var Regexyyyyddmm = new System.Text.RegularExpressions.Regex(@"\d\d\d\d-\d\d-\d\d", System.Text.RegularExpressions.RegexOptions.Compiled | System.Text.RegularExpressions.RegexOptions.Singleline); foreach (var r in rows) { string type = r[0]; string date = r[1]; if (type.HasChars() && date.HasChars()) { bool region = type?.Equals("Region", StringComparison.InvariantCultureIgnoreCase) ?? false; DateTime time = DateTime.MinValue; bool isyyyy = Regexyyyyddmm.IsMatch(date); // excel, after getting our output in, converts the damn thing to local dates.. this distinguishes it. bool success = isyyyy ? DateTime.TryParse(date, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.AssumeLocal, out time) : DateTime.TryParse(date, System.Globalization.CultureInfo.CurrentCulture, System.Globalization.DateTimeStyles.AssumeLocal, out time); if (success) { string name = r[2]; string note = r[3]; double?x = r[4].InvariantParseDoubleNull(); double?y = r[5].InvariantParseDoubleNull(); double?z = r[6].InvariantParseDoubleNull(); if (x != null && y != null && z != null) { System.Diagnostics.Debug.WriteLine("Bookmark {0} {1} {2} {3} ({4},{5},{6}", type, time.ToStringZulu(), name, note, x, y, z); currentbk = GlobalBookMarkList.Instance.FindBookmark(name, region); if (currentbk != null) { GlobalBookMarkList.Instance.AddOrUpdateBookmark(currentbk, !region, name, x.Value, y.Value, z.Value, time, note, currentbk.PlanetaryMarks); } else { currentbk = GlobalBookMarkList.Instance.AddOrUpdateBookmark(null, !region, name, x.Value, y.Value, z.Value, time, note, null); } } else { System.Diagnostics.Debug.WriteLine("Not a system with valid coords {0} {1}", r[0], r[1]); } } else { System.Diagnostics.Debug.WriteLine("Rejected due to date {0} {1}", r[0], r[1]); } } string planet = r[7]; if (planet.HasChars() && currentbk != null) { string locname = r[8]; string comment = r[9]; double?latitude = r[10].InvariantParseDoubleNull(); double?longitude = r[11].InvariantParseDoubleNull(); if (!locname.HasChars() && latitude == null && longitude == null) // whole planet bookmark { currentbk.AddOrUpdatePlanetBookmark(planet, comment); } else if (locname.HasChars() && latitude.HasValue && longitude.HasValue) { currentbk.AddOrUpdateLocation(planet, locname, comment, latitude.Value, longitude.Value); } } } SQLiteConnectionUser.PutSettingString("BookmarkFormImportExcelFolder", System.IO.Path.GetDirectoryName(path)); } else { ExtendedControls.MessageBoxTheme.Show(FindForm(), "Failed to read " + path, "Import Failed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
public void CloseDown() { actionrunasync.WaitTillFinished(10000); SQLiteConnectionUser.PutSettingString("UserGlobalActionVars", persistentglobalvariables.ToString()); }