From 79e0a0d0b555deb09bff6c652e0338ad45352b1a Mon Sep 17 00:00:00 2001 From: Xjph Date: Tue, 3 Sep 2019 20:44:01 -0230 Subject: [PATCH] Settings window added --- EDDisco/App.config | 60 ++++ EDDisco/EDDisco.csproj | 28 +- EDDisco/EDDiscoFrm.Designer.cs | 64 +--- EDDisco/EDDiscoFrm.cs | 108 ++++--- EDDisco/Properties/AssemblyInfo.cs | 10 +- EDDisco/Properties/EDDisco.Designer.cs | 254 +++++++++++++++ EDDisco/Properties/EDDisco.settings | 63 ++++ EDDisco/Properties/Resources.Designer.cs | 44 ++- EDDisco/Properties/Settings.Designer.cs | 30 -- EDDisco/Properties/Settings.settings | 7 - EDDisco/ScanEvent.cs | 4 +- EDDisco/ScanReader.cs | 58 ++-- EDDisco/SettingsFrm.Designer.cs | 396 +++++++++++++++++++++++ EDDisco/SettingsFrm.cs | 179 ++++++++++ EDDisco/SettingsFrm.resx | 123 +++++++ EDDisco/TODO.txt | 8 - 16 files changed, 1230 insertions(+), 206 deletions(-) create mode 100644 EDDisco/Properties/EDDisco.Designer.cs create mode 100644 EDDisco/Properties/EDDisco.settings delete mode 100644 EDDisco/Properties/Settings.Designer.cs delete mode 100644 EDDisco/Properties/Settings.settings create mode 100644 EDDisco/SettingsFrm.Designer.cs create mode 100644 EDDisco/SettingsFrm.cs create mode 100644 EDDisco/SettingsFrm.resx delete mode 100644 EDDisco/TODO.txt diff --git a/EDDisco/App.config b/EDDisco/App.config index 1b97f03..cf7bc4a 100644 --- a/EDDisco/App.config +++ b/EDDisco/App.config @@ -2,6 +2,7 @@ +
@@ -9,6 +10,65 @@ + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + False + + + False + + + %time% - %bodyL% - %info% - %detail% + + diff --git a/EDDisco/EDDisco.csproj b/EDDisco/EDDisco.csproj index 94e6e2b..145253a 100644 --- a/EDDisco/EDDisco.csproj +++ b/EDDisco/EDDisco.csproj @@ -8,7 +8,7 @@ {8329020D-9B20-439B-ACD9-3D20BA6CAF10} WinExe EDDisco - EDDisco + EDDiscoMon v4.5 512 true @@ -70,9 +70,15 @@ ..\packages\System.ValueTuple.4.5.0\lib\netstandard1.0\System.ValueTuple.dll + + + True + True + EDDisco.settings + Form @@ -84,6 +90,12 @@ + + Form + + + SettingsFrm.cs + EDDiscoFrm.cs @@ -95,18 +107,17 @@ True Resources.resx + True + + SettingsFrm.cs + - + SettingsSingleFileGenerator - Settings.Designer.cs + EDDisco.Designer.cs - - True - Settings.settings - True - @@ -120,7 +131,6 @@ - diff --git a/EDDisco/EDDiscoFrm.Designer.cs b/EDDisco/EDDiscoFrm.Designer.cs index 87179c3..e56d4d1 100644 --- a/EDDisco/EDDiscoFrm.Designer.cs +++ b/EDDisco/EDDiscoFrm.Designer.cs @@ -40,13 +40,11 @@ private void InitializeComponent() this.landable = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.btnReadAll = new System.Windows.Forms.Button(); this.progressReadAll = new System.Windows.Forms.ProgressBar(); - this.cbxToast = new System.Windows.Forms.CheckBox(); - this.cbxTts = new System.Windows.Forms.CheckBox(); this.contextCopy = new System.Windows.Forms.ContextMenuStrip(this.components); this.copyNameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.copyAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.cbxTtsDetail = new System.Windows.Forms.CheckBox(); this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components); + this.btnSettings = new System.Windows.Forms.Button(); this.contextCopy.SuspendLayout(); this.SuspendLayout(); // @@ -73,6 +71,8 @@ private void InitializeComponent() this.detail, this.landable}); this.listEvent.FullRowSelect = true; + this.listEvent.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.listEvent.HideSelection = false; this.listEvent.Location = new System.Drawing.Point(12, 12); this.listEvent.Name = "listEvent"; this.listEvent.Size = new System.Drawing.Size(685, 478); @@ -129,34 +129,10 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Right))); this.progressReadAll.Location = new System.Drawing.Point(14, 496); this.progressReadAll.Name = "progressReadAll"; - this.progressReadAll.Size = new System.Drawing.Size(483, 23); + this.progressReadAll.Size = new System.Drawing.Size(683, 23); this.progressReadAll.TabIndex = 4; this.progressReadAll.Visible = false; // - // cbxToast - // - this.cbxToast.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.cbxToast.AutoSize = true; - this.cbxToast.Location = new System.Drawing.Point(14, 500); - this.cbxToast.Name = "cbxToast"; - this.cbxToast.Size = new System.Drawing.Size(113, 17); - this.cbxToast.TabIndex = 5; - this.cbxToast.Text = "Popup Notification"; - this.cbxToast.UseVisualStyleBackColor = true; - this.cbxToast.CheckedChanged += new System.EventHandler(this.CbxToast_CheckedChanged); - // - // cbxTts - // - this.cbxTts.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.cbxTts.AutoSize = true; - this.cbxTts.Location = new System.Drawing.Point(129, 500); - this.cbxTts.Name = "cbxTts"; - this.cbxTts.Size = new System.Drawing.Size(99, 17); - this.cbxTts.TabIndex = 6; - this.cbxTts.Text = "Text-to-Speech"; - this.cbxTts.UseVisualStyleBackColor = true; - this.cbxTts.CheckedChanged += new System.EventHandler(this.CbxTts_CheckedChanged); - // // contextCopy // this.contextCopy.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -179,42 +155,38 @@ private void InitializeComponent() this.copyAllToolStripMenuItem.Text = "Copy All"; this.copyAllToolStripMenuItem.Click += new System.EventHandler(this.CopyAllToolStripMenuItem_Click); // - // cbxTtsDetail - // - this.cbxTtsDetail.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.cbxTtsDetail.AutoSize = true; - this.cbxTtsDetail.Location = new System.Drawing.Point(235, 500); - this.cbxTtsDetail.Name = "cbxTtsDetail"; - this.cbxTtsDetail.Size = new System.Drawing.Size(115, 17); - this.cbxTtsDetail.TabIndex = 7; - this.cbxTtsDetail.Text = "TTS Include Detail"; - this.cbxTtsDetail.UseVisualStyleBackColor = true; - this.cbxTtsDetail.Visible = false; - // // notifyIcon // this.notifyIcon.Text = "EDDiscoMon"; this.notifyIcon.Visible = true; // + // btnSettings + // + this.btnSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnSettings.Location = new System.Drawing.Point(422, 496); + this.btnSettings.Name = "btnSettings"; + this.btnSettings.Size = new System.Drawing.Size(75, 23); + this.btnSettings.TabIndex = 8; + this.btnSettings.Text = "Settings"; + this.btnSettings.UseVisualStyleBackColor = true; + this.btnSettings.Click += new System.EventHandler(this.BtnSettings_Click); + // // EDDiscoFrm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(710, 530); this.Controls.Add(this.progressReadAll); - this.Controls.Add(this.cbxTtsDetail); + this.Controls.Add(this.btnSettings); this.Controls.Add(this.btnReadAll); this.Controls.Add(this.listEvent); this.Controls.Add(this.btnToggleMonitor); - this.Controls.Add(this.cbxTts); - this.Controls.Add(this.cbxToast); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "EDDiscoFrm"; this.Text = "EDDiscoMon"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.EDDiscoFrm_FormClosing); this.contextCopy.ResumeLayout(false); this.ResumeLayout(false); - this.PerformLayout(); } @@ -225,16 +197,14 @@ private void InitializeComponent() private System.Windows.Forms.ColumnHeader interest; private System.Windows.Forms.Button btnReadAll; private System.Windows.Forms.ProgressBar progressReadAll; - private System.Windows.Forms.CheckBox cbxToast; - private System.Windows.Forms.CheckBox cbxTts; private System.Windows.Forms.ColumnHeader timestamp; private System.Windows.Forms.ColumnHeader detail; private System.Windows.Forms.ColumnHeader landable; private System.Windows.Forms.ContextMenuStrip contextCopy; private System.Windows.Forms.ToolStripMenuItem copyNameToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem copyAllToolStripMenuItem; - private System.Windows.Forms.CheckBox cbxTtsDetail; private System.Windows.Forms.NotifyIcon notifyIcon; + private System.Windows.Forms.Button btnSettings; } } diff --git a/EDDisco/EDDiscoFrm.cs b/EDDisco/EDDiscoFrm.cs index 809fa81..3f90e4f 100644 --- a/EDDisco/EDDiscoFrm.cs +++ b/EDDisco/EDDiscoFrm.cs @@ -15,8 +15,10 @@ namespace EDDisco public partial class EDDiscoFrm : Form { private LogMonitor logMonitor; - private SpeechSynthesizer speech; - + public SpeechSynthesizer speech; + private SettingsFrm settingsFrm; + public bool settingsOpen = false; + public EDDiscoFrm() { InitializeComponent(); @@ -24,7 +26,24 @@ public EDDiscoFrm() logMonitor.LogEntry += LogEvent; Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); notifyIcon.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); - notifyIcon.Visible = false; + notifyIcon.Visible = Properties.EDDisco.Default.Notify; + if (Properties.EDDisco.Default.TTS) + { + speech = new SpeechSynthesizer(); + speech.SetOutputToDefaultAudioDevice(); + } + } + + public bool Notify + { + get + { + return notifyIcon.Visible; + } + set + { + notifyIcon.Visible = value; + } } private void BtnToggleMonitor_Click(object sender, EventArgs e) @@ -56,11 +75,11 @@ private void LogEvent(object source, EventArgs e) listEvent.Items.RemoveAt(listEvent.Items.Count - 1); } bool addItem; - List<(string, string, string)> pendingRemoval = new List<(string, string, string)>(); + var pendingRemoval = new List<(string BodyName, string Description, string Detail)>(); foreach (var item in scan.Interest) { addItem = true; - if (item.Item2 == "All jumponium materials in system") + if (item.Description == "All jumponium materials in system") { for (int i = Math.Max(0, listEvent.Items.Count - 10); i < listEvent.Items.Count; i++) { @@ -90,7 +109,7 @@ private void LogEvent(object source, EventArgs e) else if (!logMonitor.ReadAllInProgress) { - ListViewItem newItem = new ListViewItem(new string[] { scan.Interest[0].Item1, "Uninteresting" }) + ListViewItem newItem = new ListViewItem(new string[] { scan.Interest[0].BodyName, "Uninteresting" }) { UseItemStyleForSubItems = false }; @@ -107,28 +126,28 @@ private void LogEvent(object source, EventArgs e) } } - private void AnnounceItems(List<(string,string,string)> items) + private void AnnounceItems(List<(string BodyName, string Description, string Detail)> items) { - if (cbxToast.Checked || cbxTts.Checked) + if (Properties.EDDisco.Default.Notify || Properties.EDDisco.Default.TTS) { notifyIcon.BalloonTipTitle = "Discovery:"; - string fullSystemName = items[0].Item1; + string fullSystemName = items[0].BodyName; StringBuilder announceText = new StringBuilder(); foreach (var item in items) { - announceText.Append(item.Item2); + announceText.Append(item.Description); if (!item.Equals(items.Last())) { announceText.AppendLine(", "); } } - if (cbxToast.Checked) + if (Properties.EDDisco.Default.Notify) { notifyIcon.BalloonTipText = fullSystemName + ": " + announceText.ToString(); notifyIcon.ShowBalloonTip(3000); } - if (cbxTts.Checked) + if (Properties.EDDisco.Default.TTS) { string sector = fullSystemName.Substring(0, fullSystemName.IndexOf('-') - 2); string system = fullSystemName.Remove(0, sector.Length).Replace('-', '–'); //Want it to say "dash", not "hyphen". @@ -138,17 +157,17 @@ private void AnnounceItems(List<(string,string,string)> items) } } - private void AddListItem((string,string,string) item) + private void AddListItem((string BodyName, string Description, string Detail) item) { ListViewItem newItem = new ListViewItem( new string[] { - item.Item1, - item.Item2, + item.BodyName, + item.Description, logMonitor.LastScan.Timestamp.ToString("yyyy-MM-dd HH:mm:ss"), - item.Item3, - (logMonitor.LastScan.Landable.GetValueOrDefault(false) && !(item.Item2 == "All jumponium materials in system")) ? "🌐" : string.Empty + item.Detail, + (logMonitor.LastScan.Landable.GetValueOrDefault(false) && !(item.Description == "All jumponium materials in system")) ? "🌐" : string.Empty }); - if (item.Item2.Contains("Interesting Object")) + if (item.Description.Contains("Interesting Object")) { newItem.UseItemStyleForSubItems = false; newItem.SubItems[1].Font = new Font(newItem.Font, FontStyle.Bold); @@ -175,26 +194,6 @@ private void BtnReadAll_Click(object sender, EventArgs e) logMonitor.ReadAll(progressReadAll); } - private void CbxToast_CheckedChanged(object sender, EventArgs e) - { - notifyIcon.Visible = cbxToast.Checked; - } - - private void CbxTts_CheckedChanged(object sender, EventArgs e) - { - if (cbxTts.Checked) - { - speech = new SpeechSynthesizer(); - speech.SetOutputToDefaultAudioDevice(); - //cbxTtsDetail.Visible = true; - } - else - { - speech.Dispose(); - //cbxTtsDetail.Visible = false; - } - } - private void EDDiscoFrm_FormClosing(object sender, FormClosingEventArgs e) { notifyIcon.Icon = null; @@ -239,12 +238,19 @@ private void CopyAllSelected() if (item.SubItems.Count == 5) { copyText.AppendLine( - item.SubItems[2].Text + " - " + - item.SubItems[0].Text + " - " + - (item.SubItems[4].Text.Length > 0 ? "Landable - " : string.Empty) + - item.SubItems[1].Text + - (item.SubItems[3].Text.Length > 0 ? " - " + item.SubItems[3].Text : string.Empty) - ); + Properties.EDDisco.Default.CopyTemplate + .Replace("%body%", item.SubItems[0].Text) + .Replace("%bodyL%", item.SubItems[0].Text + (item.SubItems[4].Text.Length > 0 ? "- Landable" : string.Empty)) + .Replace("%info%", item.SubItems[1].Text) + .Replace("%time%", item.SubItems[2].Text) + .Replace("%detail%", item.SubItems[3].Text) + ); + //item.SubItems[2].Text + " - " + + //item.SubItems[0].Text + " - " + + //(item.SubItems[4].Text.Length > 0 ? "Landable - " : string.Empty) + + //item.SubItems[1].Text + + //(item.SubItems[3].Text.Length > 0 ? " - " + item.SubItems[3].Text : string.Empty) + //); } else { @@ -255,5 +261,19 @@ private void CopyAllSelected() } Clipboard.SetText(copyText.ToString()); } + + private void BtnSettings_Click(object sender, EventArgs e) + { + if (!settingsOpen) + { + settingsFrm = new SettingsFrm(this); + settingsFrm.Show(); + settingsOpen = true; + } + else + { + settingsFrm.Activate(); + } + } } } diff --git a/EDDisco/Properties/AssemblyInfo.cs b/EDDisco/Properties/AssemblyInfo.cs index 3fed2ed..71cd1df 100644 --- a/EDDisco/Properties/AssemblyInfo.cs +++ b/EDDisco/Properties/AssemblyInfo.cs @@ -5,12 +5,12 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("EDDisco")] +[assembly: AssemblyTitle("EDDiscoMon")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("EDDisco")] -[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyProduct("EDDiscoMon")] +[assembly: AssemblyCopyright("2019 Jonathan Miller")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.1.19.165")] -[assembly: AssemblyFileVersion("0.1.19.165")] +[assembly: AssemblyVersion("0.2.19.246")] +[assembly: AssemblyFileVersion("0.2.19.246")] diff --git a/EDDisco/Properties/EDDisco.Designer.cs b/EDDisco/Properties/EDDisco.Designer.cs new file mode 100644 index 0000000..cfa6c3c --- /dev/null +++ b/EDDisco/Properties/EDDisco.Designer.cs @@ -0,0 +1,254 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace EDDisco.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] + internal sealed partial class EDDisco : global::System.Configuration.ApplicationSettingsBase { + + private static EDDisco defaultInstance = ((EDDisco)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new EDDisco()))); + + public static EDDisco Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool LandWithTerra { + get { + return ((bool)(this["LandWithTerra"])); + } + set { + this["LandWithTerra"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool LandWithAtmo { + get { + return ((bool)(this["LandWithAtmo"])); + } + set { + this["LandWithAtmo"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool LandHighG { + get { + return ((bool)(this["LandHighG"])); + } + set { + this["LandHighG"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool CloseOrbit { + get { + return ((bool)(this["CloseOrbit"])); + } + set { + this["CloseOrbit"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool ShepherdMoon { + get { + return ((bool)(this["ShepherdMoon"])); + } + set { + this["ShepherdMoon"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool CloseBinary { + get { + return ((bool)(this["CloseBinary"])); + } + set { + this["CloseBinary"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool CollidingBinary { + get { + return ((bool)(this["CollidingBinary"])); + } + set { + this["CollidingBinary"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool NestedMoon { + get { + return ((bool)(this["NestedMoon"])); + } + set { + this["NestedMoon"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool TinyObject { + get { + return ((bool)(this["TinyObject"])); + } + set { + this["TinyObject"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool FastRotate { + get { + return ((bool)(this["FastRotate"])); + } + set { + this["FastRotate"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool FastOrbit { + get { + return ((bool)(this["FastOrbit"])); + } + set { + this["FastOrbit"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool HighEccentric { + get { + return ((bool)(this["HighEccentric"])); + } + set { + this["HighEccentric"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool GoodJump { + get { + return ((bool)(this["GoodJump"])); + } + set { + this["GoodJump"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool AllJumpSystem { + get { + return ((bool)(this["AllJumpSystem"])); + } + set { + this["AllJumpSystem"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool AllJumpBody { + get { + return ((bool)(this["AllJumpBody"])); + } + set { + this["AllJumpBody"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool VeryInteresting { + get { + return ((bool)(this["VeryInteresting"])); + } + set { + this["VeryInteresting"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool Notify { + get { + return ((bool)(this["Notify"])); + } + set { + this["Notify"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool TTS { + get { + return ((bool)(this["TTS"])); + } + set { + this["TTS"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("%time% - %bodyL% - %info% - %detail%")] + public string CopyTemplate { + get { + return ((string)(this["CopyTemplate"])); + } + set { + this["CopyTemplate"] = value; + } + } + } +} diff --git a/EDDisco/Properties/EDDisco.settings b/EDDisco/Properties/EDDisco.settings new file mode 100644 index 0000000..cf6cf2e --- /dev/null +++ b/EDDisco/Properties/EDDisco.settings @@ -0,0 +1,63 @@ + + + + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + False + + + False + + + %time% - %bodyL% - %info% - %detail% + + + \ No newline at end of file diff --git a/EDDisco/Properties/Resources.Designer.cs b/EDDisco/Properties/Resources.Designer.cs index 7f72ed8..8c1121e 100644 --- a/EDDisco/Properties/Resources.Designer.cs +++ b/EDDisco/Properties/Resources.Designer.cs @@ -8,10 +8,10 @@ // //------------------------------------------------------------------------------ -namespace EDDisco.Properties -{ - - +namespace EDDisco.Properties { + using System; + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -19,51 +19,43 @@ namespace EDDisco.Properties // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - + internal class Resources { + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { + internal Resources() { } - + /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("EDDisco.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } - + /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { + internal static global::System.Globalization.CultureInfo Culture { + get { return resourceCulture; } - set - { + set { resourceCulture = value; } } diff --git a/EDDisco/Properties/Settings.Designer.cs b/EDDisco/Properties/Settings.Designer.cs deleted file mode 100644 index 0e93975..0000000 --- a/EDDisco/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace EDDisco.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } -} diff --git a/EDDisco/Properties/Settings.settings b/EDDisco/Properties/Settings.settings deleted file mode 100644 index 3964565..0000000 --- a/EDDisco/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/EDDisco/ScanEvent.cs b/EDDisco/ScanEvent.cs index cc88001..a420eb1 100644 --- a/EDDisco/ScanEvent.cs +++ b/EDDisco/ScanEvent.cs @@ -32,7 +32,7 @@ public ParentObject[] Parents { set { ParentObjects = value; - Parent = new (string, long)[value.Length]; + Parent = new (string ParentType, long Body)[value.Length]; for (int i = 0; i < value.Length; i++) { if (value[i].Null != null) @@ -51,7 +51,7 @@ public ParentObject[] Parents { } } - public (string,long)[] Parent { get; private set; } + public (string ParentType,long Body)[] Parent { get; private set; } [JsonProperty("DistanceFromArrivalLS")] public double DistanceFromArrivalLs { get; set; } diff --git a/EDDisco/ScanReader.cs b/EDDisco/ScanReader.cs index af0e7ae..5ec511b 100644 --- a/EDDisco/ScanReader.cs +++ b/EDDisco/ScanReader.cs @@ -9,18 +9,18 @@ namespace EDDisco class ScanReader { private readonly ScanEvent scanEvent; - private readonly Dictionary<(string, long), ScanEvent> scanHistory; + private readonly Dictionary<(string System, long Body), ScanEvent> scanHistory; private readonly string currentSystem; private readonly bool isRing; - public List<(string,string,string)> Interest { get; private set; } + public List<(string BodyName, string Description, string Detail)> Interest { get; private set; } - public ScanReader (ScanEvent scanEvent, Dictionary<(string,long),ScanEvent> scanHistory, string currentSystem) + public ScanReader (ScanEvent scanEvent, Dictionary<(string System, long Body),ScanEvent> scanHistory, string currentSystem) { this.scanEvent = scanEvent; this.scanHistory = scanHistory; this.currentSystem = currentSystem; isRing = scanEvent.BodyName.Contains(" Ring"); - Interest = new List<(string,string,string)>(); + Interest = new List<(string BodyName, string Description, string Detail)>(); } public bool IsInteresting() @@ -35,57 +35,59 @@ public bool IsInteresting() private bool DefaultInterest() { + Properties.EDDisco settings = Properties.EDDisco.Default; + // Landable and has a terraform state - if (scanEvent.Landable.GetValueOrDefault(false) && scanEvent.TerraformState.Length > 0) + if (settings.LandWithTerra && scanEvent.Landable.GetValueOrDefault(false) && scanEvent.TerraformState.Length > 0) { Interest.Add((scanEvent.BodyName, $"Landable and {scanEvent.TerraformState}", string.Empty)); } // Landable with atmosphere. Futureproofing! - if (scanEvent.Landable.GetValueOrDefault(false) && scanEvent.Atmosphere.Length > 0) + if (settings.LandWithAtmo && scanEvent.Landable.GetValueOrDefault(false) && scanEvent.Atmosphere.Length > 0) { Interest.Add((scanEvent.BodyName, "Landable with Atmosphere?!", string.Empty)); } // Landable high-g - if (scanEvent.Landable.GetValueOrDefault(false) && scanEvent.SurfaceGravity > 29.4) + if (settings.LandHighG && scanEvent.Landable.GetValueOrDefault(false) && scanEvent.SurfaceGravity > 29.4) { Interest.Add((scanEvent.BodyName, "Landable with High Gravity", $"Surface gravity: {((double)scanEvent.SurfaceGravity / 9.81).ToString("0.00")}g")); } //Parent relative checks - if ((scanEvent.Parent?[0].Item1 == "Planet" || scanEvent.Parent?[0].Item1 == "Star") && - !isRing && scanHistory.ContainsKey((currentSystem, scanEvent.Parent[0].Item2))) + if ((settings.CloseOrbit || settings.ShepherdMoon) && (scanEvent.Parent?[0].ParentType == "Planet" || scanEvent.Parent?[0].ParentType == "Star") && + !isRing && scanHistory.ContainsKey((currentSystem, scanEvent.Parent[0].Body))) { - ScanEvent parent = scanHistory[(currentSystem, scanEvent.Parent[0].Item2)]; + ScanEvent parent = scanHistory[(currentSystem, scanEvent.Parent[0].Body)]; //Close orbit - if (parent.Radius * 3 > scanEvent.SemiMajorAxis) + if (settings.CloseOrbit && parent.Radius * 3 > scanEvent.SemiMajorAxis) { Interest.Add((scanEvent.BodyName, "Close orbit relative to parent body size", $"Orbit: {Math.Truncate((double)scanEvent.SemiMajorAxis / 1000):N0}km, Parent radius: {Math.Truncate((double)parent.Radius / 1000):N0}km")); } //Body inside ring - if (parent.Rings?.Last().OuterRad > scanEvent.SemiMajorAxis && !parent.Rings.Last().Name.Contains(" Belt")) + if (settings.ShepherdMoon && parent.Rings?.Last().OuterRad > scanEvent.SemiMajorAxis && !parent.Rings.Last().Name.Contains(" Belt")) { - Interest.Add((scanEvent.BodyName, "Orbit closer than outermost ring edge", $"Orbit: {Math.Truncate((double)scanEvent.SemiMajorAxis / 1000):N0}km, Ring radius: {Math.Truncate((double)parent.Rings.Last().OuterRad / 1000):N0}km")); + Interest.Add((scanEvent.BodyName, "Shepherd moon", $"Orbit: {Math.Truncate((double)scanEvent.SemiMajorAxis / 1000):N0}km, Ring radius: {Math.Truncate((double)parent.Rings.Last().OuterRad / 1000):N0}km")); } } // Close binary pair - if (scanEvent.Parent?[0].Item1 == "Null" && scanEvent.Radius / scanEvent.SemiMajorAxis > 0.5) + if ((settings.CloseBinary || settings.CollidingBinary) && scanEvent.Parent?[0].ParentType == "Null" && scanEvent.Radius / scanEvent.SemiMajorAxis > 0.5) { - var binaryPartner = scanHistory.Where(system => system.Key.Item1 == currentSystem && scanEvent.Parent?[0].Item2 == system.Value.Parent?[0].Item2 && scanEvent.BodyId != system.Value.BodyId); + var binaryPartner = scanHistory.Where(system => system.Key.System == currentSystem && scanEvent.Parent?[0].Body == system.Value.Parent?[0].Body && scanEvent.BodyId != system.Value.BodyId); if (binaryPartner.Count() == 1) { if (binaryPartner.First().Value.Radius / binaryPartner.First().Value.SemiMajorAxis > 0.5) { - if (binaryPartner.First().Value.Radius + scanEvent.Radius >= binaryPartner.First().Value.SemiMajorAxis * (1 - binaryPartner.First().Value.Eccentricity) + scanEvent.SemiMajorAxis * (1 - scanEvent.Eccentricity)) + if (settings.CollidingBinary && binaryPartner.First().Value.Radius + scanEvent.Radius >= binaryPartner.First().Value.SemiMajorAxis * (1 - binaryPartner.First().Value.Eccentricity) + scanEvent.SemiMajorAxis * (1 - scanEvent.Eccentricity)) { Interest.Add((scanEvent.BodyName, "COLLIDING binary", $"Orbit: {Math.Truncate((double)scanEvent.SemiMajorAxis / 1000):N0}km, Radius: {Math.Truncate((double)scanEvent.Radius / 1000):N0}km, Partner: {binaryPartner.First().Value.BodyName}")); } - else + else if (settings.CloseBinary) { Interest.Add((scanEvent.BodyName, "Close binary relative to body size", $"Orbit: {Math.Truncate((double)scanEvent.SemiMajorAxis / 1000):N0}km, Radius: {Math.Truncate((double)scanEvent.Radius / 1000):N0}km, Partner: {binaryPartner.First().Value.BodyName}")); } @@ -94,37 +96,37 @@ private bool DefaultInterest() } // Moon of a moon - if (scanEvent.Parent?.Count() > 1 && scanEvent.Parent[0].Item1 == "Planet" && scanEvent.Parent[1].Item1 == "Planet") + if (settings.NestedMoon && scanEvent.Parent?.Count() > 1 && scanEvent.Parent[0].ParentType == "Planet" && scanEvent.Parent[1].ParentType == "Planet") { Interest.Add((scanEvent.BodyName, "Nested Moon", string.Empty)); } // Tiny object - if (scanEvent.StarType == null && scanEvent.Radius < 300000 && !isRing) + if (settings.TinyObject && scanEvent.StarType == null && scanEvent.Radius < 300000 && !isRing) { Interest.Add((scanEvent.BodyName, "Small Body", $"Radius: {Math.Truncate((double)scanEvent.Radius / 1000)}km")); } // Fast rotation - if (scanEvent.RotationPeriod != null && !scanEvent.TidalLock.GetValueOrDefault(true) && Math.Abs((double)scanEvent.RotationPeriod) < 28800 && !isRing) + if (settings.FastRotate && scanEvent.RotationPeriod != null && !scanEvent.TidalLock.GetValueOrDefault(true) && Math.Abs((double)scanEvent.RotationPeriod) < 28800 && !isRing) { Interest.Add((scanEvent.BodyName, "Non-locked body with fast rotation", $"Rotational period: {Math.Abs(Math.Round((decimal)scanEvent.RotationPeriod / 3600, 1))} hours")); } // Fast orbit - if (scanEvent.OrbitalPeriod != null && Math.Abs((double)scanEvent.OrbitalPeriod) < 28800 && !isRing) + if (settings.FastOrbit && scanEvent.OrbitalPeriod != null && Math.Abs((double)scanEvent.OrbitalPeriod) < 28800 && !isRing) { Interest.Add((scanEvent.BodyName, "Fast orbit", $"Orbital Period: {Math.Abs(Math.Round((decimal)scanEvent.OrbitalPeriod / 3600, 1))} hours")); } // High eccentricity - if (scanEvent.Eccentricity > 0.9) + if (settings.HighEccentric && scanEvent.Eccentricity > 0.9) { Interest.Add((scanEvent.BodyName, "Highly eccentric orbit", $"Eccentricity: {Math.Round((decimal)scanEvent.Eccentricity, 2)}")); } // Good jumponium material availability - if (scanEvent.Landable.GetValueOrDefault(false)) + if ((settings.AllJumpBody || settings.GoodJump) && scanEvent.Landable.GetValueOrDefault(false)) { int jumpMats = 0; string matsNotFound = "carbongermaniumarsenicniobiumyttriumpolonium"; @@ -143,29 +145,29 @@ private bool DefaultInterest() break; } } - if (jumpMats == 6) + if (settings.AllJumpBody && jumpMats == 6) { Interest.Add((scanEvent.BodyName, "One stop jumponium shop", string.Empty)); } - else if (jumpMats == 5) + else if (settings.GoodJump && jumpMats == 5) { Interest.Add((scanEvent.BodyName, "5 out of 6 jumponium materials", $"Missing material: {matsNotFound}")); } } // Add note if multiple checks triggered - if (Interest.Count() > 1) + if (settings.VeryInteresting && Interest.Count() > 1) { Interest.Add((scanEvent.BodyName, $"{(Interest.Count() > 2 ? "Very":"More")} Interesting Object", string.Empty)); } // Check history to determine if all jumponium materials available in system - if (scanEvent.Landable.GetValueOrDefault(false)) + if (settings.AllJumpSystem && scanEvent.Landable.GetValueOrDefault(false)) { string matsNotFound = "carbongermaniumarsenicniobiumyttriumpolonium"; foreach (var scan in scanHistory) { - if (scan.Key.Item1 == currentSystem && scan.Value.Landable.GetValueOrDefault(false)) + if (scan.Key.System == currentSystem && scan.Value.Landable.GetValueOrDefault(false)) { foreach (MaterialComposition material in scan.Value.Materials) { diff --git a/EDDisco/SettingsFrm.Designer.cs b/EDDisco/SettingsFrm.Designer.cs new file mode 100644 index 0000000..b4aa6a1 --- /dev/null +++ b/EDDisco/SettingsFrm.Designer.cs @@ -0,0 +1,396 @@ +namespace EDDisco +{ + partial class SettingsFrm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.groupBox_Interest = new System.Windows.Forms.GroupBox(); + this.cbx_VeryInteresting = new System.Windows.Forms.CheckBox(); + this.cbx_AllJumpSystem = new System.Windows.Forms.CheckBox(); + this.cbx_AllJumpBody = new System.Windows.Forms.CheckBox(); + this.cbx_GoodJump = new System.Windows.Forms.CheckBox(); + this.cbx_HighEccentric = new System.Windows.Forms.CheckBox(); + this.cbx_FastOrbit = new System.Windows.Forms.CheckBox(); + this.cbx_FastRotate = new System.Windows.Forms.CheckBox(); + this.cbx_TinyObject = new System.Windows.Forms.CheckBox(); + this.cbx_NestedMoon = new System.Windows.Forms.CheckBox(); + this.cbx_CollidingBinary = new System.Windows.Forms.CheckBox(); + this.cbx_CloseBinary = new System.Windows.Forms.CheckBox(); + this.cbx_ShepherdMoon = new System.Windows.Forms.CheckBox(); + this.cbx_CloseOrbit = new System.Windows.Forms.CheckBox(); + this.cbx_LandHighG = new System.Windows.Forms.CheckBox(); + this.cbx_LandWithAtmo = new System.Windows.Forms.CheckBox(); + this.cbx_LandWithTerra = new System.Windows.Forms.CheckBox(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.btnCopyReset = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.txtCopy = new System.Windows.Forms.TextBox(); + this.cbxTtsDetail = new System.Windows.Forms.CheckBox(); + this.cbxTts = new System.Windows.Forms.CheckBox(); + this.cbxToast = new System.Windows.Forms.CheckBox(); + this.tipCopy = new System.Windows.Forms.ToolTip(this.components); + this.groupBox_Interest.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox_Interest + // + this.groupBox_Interest.Controls.Add(this.cbx_VeryInteresting); + this.groupBox_Interest.Controls.Add(this.cbx_AllJumpSystem); + this.groupBox_Interest.Controls.Add(this.cbx_AllJumpBody); + this.groupBox_Interest.Controls.Add(this.cbx_GoodJump); + this.groupBox_Interest.Controls.Add(this.cbx_HighEccentric); + this.groupBox_Interest.Controls.Add(this.cbx_FastOrbit); + this.groupBox_Interest.Controls.Add(this.cbx_FastRotate); + this.groupBox_Interest.Controls.Add(this.cbx_TinyObject); + this.groupBox_Interest.Controls.Add(this.cbx_NestedMoon); + this.groupBox_Interest.Controls.Add(this.cbx_CollidingBinary); + this.groupBox_Interest.Controls.Add(this.cbx_CloseBinary); + this.groupBox_Interest.Controls.Add(this.cbx_ShepherdMoon); + this.groupBox_Interest.Controls.Add(this.cbx_CloseOrbit); + this.groupBox_Interest.Controls.Add(this.cbx_LandHighG); + this.groupBox_Interest.Controls.Add(this.cbx_LandWithAtmo); + this.groupBox_Interest.Controls.Add(this.cbx_LandWithTerra); + this.groupBox_Interest.Location = new System.Drawing.Point(13, 13); + this.groupBox_Interest.Name = "groupBox_Interest"; + this.groupBox_Interest.Size = new System.Drawing.Size(340, 208); + this.groupBox_Interest.TabIndex = 0; + this.groupBox_Interest.TabStop = false; + this.groupBox_Interest.Text = "Interest Criteria"; + // + // cbx_VeryInteresting + // + this.cbx_VeryInteresting.AutoSize = true; + this.cbx_VeryInteresting.Location = new System.Drawing.Point(160, 180); + this.cbx_VeryInteresting.Name = "cbx_VeryInteresting"; + this.cbx_VeryInteresting.Size = new System.Drawing.Size(99, 17); + this.cbx_VeryInteresting.TabIndex = 15; + this.cbx_VeryInteresting.Text = "Very Interesting"; + this.cbx_VeryInteresting.UseVisualStyleBackColor = true; + this.cbx_VeryInteresting.CheckedChanged += new System.EventHandler(this.Cbx_VeryInteresting_CheckedChanged); + // + // cbx_AllJumpSystem + // + this.cbx_AllJumpSystem.AutoSize = true; + this.cbx_AllJumpSystem.Location = new System.Drawing.Point(160, 157); + this.cbx_AllJumpSystem.Name = "cbx_AllJumpSystem"; + this.cbx_AllJumpSystem.Size = new System.Drawing.Size(165, 17); + this.cbx_AllJumpSystem.TabIndex = 14; + this.cbx_AllJumpSystem.Text = "All Jumponium Avail. (System)"; + this.cbx_AllJumpSystem.UseVisualStyleBackColor = true; + this.cbx_AllJumpSystem.CheckedChanged += new System.EventHandler(this.Cbx_AllJumpSystem_CheckedChanged); + // + // cbx_AllJumpBody + // + this.cbx_AllJumpBody.AutoSize = true; + this.cbx_AllJumpBody.Location = new System.Drawing.Point(160, 134); + this.cbx_AllJumpBody.Name = "cbx_AllJumpBody"; + this.cbx_AllJumpBody.Size = new System.Drawing.Size(155, 17); + this.cbx_AllJumpBody.TabIndex = 13; + this.cbx_AllJumpBody.Text = "All Jumponium Avail. (Body)"; + this.cbx_AllJumpBody.UseVisualStyleBackColor = true; + this.cbx_AllJumpBody.CheckedChanged += new System.EventHandler(this.Cbx_AllJumpBody_CheckedChanged); + // + // cbx_GoodJump + // + this.cbx_GoodJump.AutoSize = true; + this.cbx_GoodJump.Location = new System.Drawing.Point(160, 111); + this.cbx_GoodJump.Name = "cbx_GoodJump"; + this.cbx_GoodJump.Size = new System.Drawing.Size(137, 17); + this.cbx_GoodJump.TabIndex = 12; + this.cbx_GoodJump.Text = "Good Jumponium Avail."; + this.cbx_GoodJump.UseVisualStyleBackColor = true; + this.cbx_GoodJump.CheckedChanged += new System.EventHandler(this.Cbx_GoodJump_CheckedChanged); + // + // cbx_HighEccentric + // + this.cbx_HighEccentric.AutoSize = true; + this.cbx_HighEccentric.Location = new System.Drawing.Point(160, 88); + this.cbx_HighEccentric.Name = "cbx_HighEccentric"; + this.cbx_HighEccentric.Size = new System.Drawing.Size(106, 17); + this.cbx_HighEccentric.TabIndex = 11; + this.cbx_HighEccentric.Text = "High Eccentricity"; + this.cbx_HighEccentric.UseVisualStyleBackColor = true; + this.cbx_HighEccentric.CheckedChanged += new System.EventHandler(this.Cbx_HighEccentric_CheckedChanged); + // + // cbx_FastOrbit + // + this.cbx_FastOrbit.AutoSize = true; + this.cbx_FastOrbit.Location = new System.Drawing.Point(160, 65); + this.cbx_FastOrbit.Name = "cbx_FastOrbit"; + this.cbx_FastOrbit.Size = new System.Drawing.Size(71, 17); + this.cbx_FastOrbit.TabIndex = 10; + this.cbx_FastOrbit.Text = "Fast Orbit"; + this.cbx_FastOrbit.UseVisualStyleBackColor = true; + this.cbx_FastOrbit.CheckedChanged += new System.EventHandler(this.Cbx_FastOrbit_CheckedChanged); + // + // cbx_FastRotate + // + this.cbx_FastRotate.AutoSize = true; + this.cbx_FastRotate.Location = new System.Drawing.Point(160, 42); + this.cbx_FastRotate.Name = "cbx_FastRotate"; + this.cbx_FastRotate.Size = new System.Drawing.Size(89, 17); + this.cbx_FastRotate.TabIndex = 9; + this.cbx_FastRotate.Text = "Fast Rotation"; + this.cbx_FastRotate.UseVisualStyleBackColor = true; + this.cbx_FastRotate.CheckedChanged += new System.EventHandler(this.Cbx_FastRotate_CheckedChanged); + // + // cbx_TinyObject + // + this.cbx_TinyObject.AutoSize = true; + this.cbx_TinyObject.Location = new System.Drawing.Point(160, 20); + this.cbx_TinyObject.Name = "cbx_TinyObject"; + this.cbx_TinyObject.Size = new System.Drawing.Size(80, 17); + this.cbx_TinyObject.TabIndex = 8; + this.cbx_TinyObject.Text = "Tiny Object"; + this.cbx_TinyObject.UseVisualStyleBackColor = true; + this.cbx_TinyObject.CheckedChanged += new System.EventHandler(this.Cbx_TinyObject_CheckedChanged); + // + // cbx_NestedMoon + // + this.cbx_NestedMoon.AutoSize = true; + this.cbx_NestedMoon.Location = new System.Drawing.Point(6, 180); + this.cbx_NestedMoon.Name = "cbx_NestedMoon"; + this.cbx_NestedMoon.Size = new System.Drawing.Size(90, 17); + this.cbx_NestedMoon.TabIndex = 7; + this.cbx_NestedMoon.Text = "Nested Moon"; + this.cbx_NestedMoon.UseVisualStyleBackColor = true; + this.cbx_NestedMoon.CheckedChanged += new System.EventHandler(this.Cbx_NestedMoon_CheckedChanged); + // + // cbx_CollidingBinary + // + this.cbx_CollidingBinary.AutoSize = true; + this.cbx_CollidingBinary.Location = new System.Drawing.Point(6, 157); + this.cbx_CollidingBinary.Name = "cbx_CollidingBinary"; + this.cbx_CollidingBinary.Size = new System.Drawing.Size(97, 17); + this.cbx_CollidingBinary.TabIndex = 6; + this.cbx_CollidingBinary.Text = "Colliding Binary"; + this.cbx_CollidingBinary.UseVisualStyleBackColor = true; + this.cbx_CollidingBinary.CheckedChanged += new System.EventHandler(this.Cbx_CollidingBinary_CheckedChanged); + // + // cbx_CloseBinary + // + this.cbx_CloseBinary.AutoSize = true; + this.cbx_CloseBinary.Location = new System.Drawing.Point(6, 134); + this.cbx_CloseBinary.Name = "cbx_CloseBinary"; + this.cbx_CloseBinary.Size = new System.Drawing.Size(84, 17); + this.cbx_CloseBinary.TabIndex = 5; + this.cbx_CloseBinary.Text = "Close Binary"; + this.cbx_CloseBinary.UseVisualStyleBackColor = true; + this.cbx_CloseBinary.CheckedChanged += new System.EventHandler(this.Cbx_CloseBinary_CheckedChanged); + // + // cbx_ShepherdMoon + // + this.cbx_ShepherdMoon.AutoSize = true; + this.cbx_ShepherdMoon.Location = new System.Drawing.Point(6, 111); + this.cbx_ShepherdMoon.Name = "cbx_ShepherdMoon"; + this.cbx_ShepherdMoon.Size = new System.Drawing.Size(102, 17); + this.cbx_ShepherdMoon.TabIndex = 4; + this.cbx_ShepherdMoon.Text = "Shepherd Moon"; + this.cbx_ShepherdMoon.UseVisualStyleBackColor = true; + this.cbx_ShepherdMoon.CheckedChanged += new System.EventHandler(this.Cbx_ShepherdMoon_CheckedChanged); + // + // cbx_CloseOrbit + // + this.cbx_CloseOrbit.AutoSize = true; + this.cbx_CloseOrbit.Location = new System.Drawing.Point(6, 88); + this.cbx_CloseOrbit.Name = "cbx_CloseOrbit"; + this.cbx_CloseOrbit.Size = new System.Drawing.Size(77, 17); + this.cbx_CloseOrbit.TabIndex = 3; + this.cbx_CloseOrbit.Text = "Close Orbit"; + this.cbx_CloseOrbit.UseVisualStyleBackColor = true; + this.cbx_CloseOrbit.CheckedChanged += new System.EventHandler(this.Cbx_CloseOrbit_CheckedChanged); + // + // cbx_LandHighG + // + this.cbx_LandHighG.AutoSize = true; + this.cbx_LandHighG.Location = new System.Drawing.Point(6, 65); + this.cbx_LandHighG.Name = "cbx_LandHighG"; + this.cbx_LandHighG.Size = new System.Drawing.Size(106, 17); + this.cbx_LandHighG.TabIndex = 2; + this.cbx_LandHighG.Text = "Landable High-G"; + this.cbx_LandHighG.UseVisualStyleBackColor = true; + this.cbx_LandHighG.CheckedChanged += new System.EventHandler(this.Cbx_LandHighG_CheckedChanged); + // + // cbx_LandWithAtmo + // + this.cbx_LandWithAtmo.AutoSize = true; + this.cbx_LandWithAtmo.Location = new System.Drawing.Point(6, 43); + this.cbx_LandWithAtmo.Name = "cbx_LandWithAtmo"; + this.cbx_LandWithAtmo.Size = new System.Drawing.Size(145, 17); + this.cbx_LandWithAtmo.TabIndex = 1; + this.cbx_LandWithAtmo.Text = "Landable w/ Atmosphere"; + this.cbx_LandWithAtmo.UseVisualStyleBackColor = true; + this.cbx_LandWithAtmo.CheckedChanged += new System.EventHandler(this.Cbx_LandWithAtmo_CheckedChanged); + // + // cbx_LandWithTerra + // + this.cbx_LandWithTerra.AutoSize = true; + this.cbx_LandWithTerra.Location = new System.Drawing.Point(6, 20); + this.cbx_LandWithTerra.Name = "cbx_LandWithTerra"; + this.cbx_LandWithTerra.Size = new System.Drawing.Size(147, 17); + this.cbx_LandWithTerra.TabIndex = 0; + this.cbx_LandWithTerra.Text = "Landable && Terraformable"; + this.cbx_LandWithTerra.UseVisualStyleBackColor = true; + this.cbx_LandWithTerra.CheckedChanged += new System.EventHandler(this.Cbx_LandWithTerra_CheckedChanged); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.btnCopyReset); + this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Controls.Add(this.txtCopy); + this.groupBox1.Controls.Add(this.cbxTtsDetail); + this.groupBox1.Controls.Add(this.cbxTts); + this.groupBox1.Controls.Add(this.cbxToast); + this.groupBox1.Location = new System.Drawing.Point(13, 228); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(340, 71); + this.groupBox1.TabIndex = 1; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Misc."; + // + // btnCopyReset + // + this.btnCopyReset.Location = new System.Drawing.Point(289, 19); + this.btnCopyReset.Name = "btnCopyReset"; + this.btnCopyReset.Size = new System.Drawing.Size(45, 23); + this.btnCopyReset.TabIndex = 13; + this.btnCopyReset.Text = "Reset"; + this.btnCopyReset.UseVisualStyleBackColor = true; + this.btnCopyReset.Click += new System.EventHandler(this.BtnCopyReset_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(6, 23); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(81, 13); + this.label1.TabIndex = 12; + this.label1.Text = "Copy Template:"; + // + // txtCopy + // + this.txtCopy.Location = new System.Drawing.Point(93, 20); + this.txtCopy.Name = "txtCopy"; + this.txtCopy.Size = new System.Drawing.Size(190, 20); + this.txtCopy.TabIndex = 11; + this.tipCopy.SetToolTip(this.txtCopy, "%time% - Timestamp\r\n%body% - Body name\r\n%bodyL% - Body name with landable status\r" + + "\n%info% - Interest criteria\r\n%detail% - Detailed information"); + this.txtCopy.TextChanged += new System.EventHandler(this.TxtCopy_TextChanged); + // + // cbxTtsDetail + // + this.cbxTtsDetail.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.cbxTtsDetail.AutoSize = true; + this.cbxTtsDetail.Location = new System.Drawing.Point(225, 48); + this.cbxTtsDetail.Name = "cbxTtsDetail"; + this.cbxTtsDetail.Size = new System.Drawing.Size(115, 17); + this.cbxTtsDetail.TabIndex = 10; + this.cbxTtsDetail.Text = "TTS Include Detail"; + this.cbxTtsDetail.UseVisualStyleBackColor = true; + this.cbxTtsDetail.Visible = false; + // + // cbxTts + // + this.cbxTts.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.cbxTts.AutoSize = true; + this.cbxTts.Location = new System.Drawing.Point(119, 48); + this.cbxTts.Name = "cbxTts"; + this.cbxTts.Size = new System.Drawing.Size(99, 17); + this.cbxTts.TabIndex = 9; + this.cbxTts.Text = "Text-to-Speech"; + this.cbxTts.UseVisualStyleBackColor = true; + this.cbxTts.CheckedChanged += new System.EventHandler(this.CbxTts_CheckedChanged); + // + // cbxToast + // + this.cbxToast.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.cbxToast.AutoSize = true; + this.cbxToast.Location = new System.Drawing.Point(4, 48); + this.cbxToast.Name = "cbxToast"; + this.cbxToast.Size = new System.Drawing.Size(113, 17); + this.cbxToast.TabIndex = 8; + this.cbxToast.Text = "Popup Notification"; + this.cbxToast.UseVisualStyleBackColor = true; + this.cbxToast.CheckedChanged += new System.EventHandler(this.CbxToast_CheckedChanged); + // + // tipCopy + // + this.tipCopy.ShowAlways = true; + // + // SettingsFrm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(369, 309); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.groupBox_Interest); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "SettingsFrm"; + this.Text = "EDDiscoMon Settings"; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.SettingsFrm_FormClosed); + this.Load += new System.EventHandler(this.SettingsFrm_Load); + this.groupBox_Interest.ResumeLayout(false); + this.groupBox_Interest.PerformLayout(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBox_Interest; + private System.Windows.Forms.CheckBox cbx_LandWithTerra; + private System.Windows.Forms.CheckBox cbx_VeryInteresting; + private System.Windows.Forms.CheckBox cbx_AllJumpSystem; + private System.Windows.Forms.CheckBox cbx_AllJumpBody; + private System.Windows.Forms.CheckBox cbx_GoodJump; + private System.Windows.Forms.CheckBox cbx_HighEccentric; + private System.Windows.Forms.CheckBox cbx_FastOrbit; + private System.Windows.Forms.CheckBox cbx_FastRotate; + private System.Windows.Forms.CheckBox cbx_TinyObject; + private System.Windows.Forms.CheckBox cbx_NestedMoon; + private System.Windows.Forms.CheckBox cbx_CollidingBinary; + private System.Windows.Forms.CheckBox cbx_CloseBinary; + private System.Windows.Forms.CheckBox cbx_ShepherdMoon; + private System.Windows.Forms.CheckBox cbx_CloseOrbit; + private System.Windows.Forms.CheckBox cbx_LandHighG; + private System.Windows.Forms.CheckBox cbx_LandWithAtmo; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.CheckBox cbxTtsDetail; + private System.Windows.Forms.CheckBox cbxTts; + private System.Windows.Forms.CheckBox cbxToast; + private System.Windows.Forms.Button btnCopyReset; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox txtCopy; + private System.Windows.Forms.ToolTip tipCopy; + } +} \ No newline at end of file diff --git a/EDDisco/SettingsFrm.cs b/EDDisco/SettingsFrm.cs new file mode 100644 index 0000000..e958001 --- /dev/null +++ b/EDDisco/SettingsFrm.cs @@ -0,0 +1,179 @@ +using System; +using System.Drawing; +using System.Windows.Forms; + +namespace EDDisco +{ + public partial class SettingsFrm : Form + { + private Properties.EDDisco settings; + private EDDiscoFrm mainForm; + + public SettingsFrm(EDDiscoFrm mainForm) + { + InitializeComponent(); + Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); + settings = Properties.EDDisco.Default; + this.mainForm = mainForm; + } + + private void SettingsFrm_FormClosed(object sender, FormClosedEventArgs e) + { + mainForm.settingsOpen = false; + } + + private void SettingsFrm_Load(object sender, EventArgs e) + { + cbx_LandWithTerra.Checked = settings.LandWithTerra; + cbx_LandWithAtmo.Checked = settings.LandWithAtmo; + cbx_LandHighG.Checked = settings.LandHighG; + cbx_AllJumpBody.Checked = settings.AllJumpBody; + cbx_AllJumpSystem.Checked = settings.AllJumpSystem; + cbx_CloseBinary.Checked = settings.CloseBinary; + cbx_CloseOrbit.Checked = settings.CloseOrbit; + cbx_CollidingBinary.Checked = settings.CollidingBinary; + cbx_FastOrbit.Checked = settings.FastOrbit; + cbx_FastRotate.Checked = settings.FastRotate; + cbx_GoodJump.Checked = settings.GoodJump; + cbx_HighEccentric.Checked = settings.HighEccentric; + cbx_NestedMoon.Checked = settings.NestedMoon; + cbx_ShepherdMoon.Checked = settings.ShepherdMoon; + cbx_TinyObject.Checked = settings.TinyObject; + cbx_VeryInteresting.Checked = settings.VeryInteresting; + cbxToast.Checked = settings.Notify; + cbxTts.Checked = settings.TTS; + txtCopy.Text = settings.CopyTemplate; + } + + private void Cbx_LandWithTerra_CheckedChanged(object sender, EventArgs e) + { + settings.LandWithTerra = ((CheckBox)sender).Checked; + settings.Save(); + } + + private void Cbx_LandWithAtmo_CheckedChanged(object sender, EventArgs e) + { + settings.LandWithAtmo = ((CheckBox)sender).Checked; + settings.Save(); + } + + private void Cbx_LandHighG_CheckedChanged(object sender, EventArgs e) + { + settings.LandHighG = ((CheckBox)sender).Checked; + settings.Save(); + } + + private void Cbx_CloseOrbit_CheckedChanged(object sender, EventArgs e) + { + settings.CloseOrbit = ((CheckBox)sender).Checked; + settings.Save(); + } + + private void Cbx_ShepherdMoon_CheckedChanged(object sender, EventArgs e) + { + settings.ShepherdMoon = ((CheckBox)sender).Checked; + settings.Save(); + } + + private void Cbx_CloseBinary_CheckedChanged(object sender, EventArgs e) + { + settings.CloseBinary = ((CheckBox)sender).Checked; + settings.Save(); + } + + private void Cbx_CollidingBinary_CheckedChanged(object sender, EventArgs e) + { + settings.CollidingBinary = ((CheckBox)sender).Checked; + settings.Save(); + } + + private void Cbx_NestedMoon_CheckedChanged(object sender, EventArgs e) + { + settings.NestedMoon = ((CheckBox)sender).Checked; + settings.Save(); + } + + private void Cbx_TinyObject_CheckedChanged(object sender, EventArgs e) + { + settings.TinyObject = ((CheckBox)sender).Checked; + settings.Save(); + } + + private void Cbx_FastRotate_CheckedChanged(object sender, EventArgs e) + { + settings.FastRotate = ((CheckBox)sender).Checked; + settings.Save(); + } + + private void Cbx_FastOrbit_CheckedChanged(object sender, EventArgs e) + { + settings.FastOrbit = ((CheckBox)sender).Checked; + settings.Save(); + } + + private void Cbx_HighEccentric_CheckedChanged(object sender, EventArgs e) + { + settings.HighEccentric = ((CheckBox)sender).Checked; + settings.Save(); + } + + private void Cbx_GoodJump_CheckedChanged(object sender, EventArgs e) + { + settings.GoodJump = ((CheckBox)sender).Checked; + settings.Save(); + } + + private void Cbx_AllJumpBody_CheckedChanged(object sender, EventArgs e) + { + settings.AllJumpBody = ((CheckBox)sender).Checked; + settings.Save(); + } + + private void Cbx_AllJumpSystem_CheckedChanged(object sender, EventArgs e) + { + settings.AllJumpSystem = ((CheckBox)sender).Checked; + settings.Save(); + } + + private void Cbx_VeryInteresting_CheckedChanged(object sender, EventArgs e) + { + settings.VeryInteresting = ((CheckBox)sender).Checked; + settings.Save(); + } + + private void CbxToast_CheckedChanged(object sender, EventArgs e) + { + mainForm.Notify = ((CheckBox)sender).Checked; + settings.Notify = ((CheckBox)sender).Checked; + settings.Save(); + } + + private void CbxTts_CheckedChanged(object sender, EventArgs e) + { + if (cbxTts.Checked) + { + mainForm.speech = new System.Speech.Synthesis.SpeechSynthesizer(); + mainForm.speech.SetOutputToDefaultAudioDevice(); + //cbxTtsDetail.Visible = true; + } + else + { + mainForm.speech.Dispose(); + //cbxTtsDetail.Visible = false; + } + settings.TTS = cbxTts.Checked; + settings.Save(); + } + + private void BtnCopyReset_Click(object sender, EventArgs e) + { + txtCopy.Text = "%time% - %bodyL% - %info% - %detail%"; + } + + private void TxtCopy_TextChanged(object sender, EventArgs e) + { + settings.CopyTemplate = txtCopy.Text; + settings.Save(); + } + } +} diff --git a/EDDisco/SettingsFrm.resx b/EDDisco/SettingsFrm.resx new file mode 100644 index 0000000..7c4f4f1 --- /dev/null +++ b/EDDisco/SettingsFrm.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/EDDisco/TODO.txt b/EDDisco/TODO.txt deleted file mode 100644 index e89230a..0000000 --- a/EDDisco/TODO.txt +++ /dev/null @@ -1,8 +0,0 @@ -TO DO: - -- User configurable notification criteria -- Settings window - - Configure format of "copy all" - - Enable/disable built in criteria - - Configure TTS voice -- Investigate possibility of notifying via in-game chat \ No newline at end of file