diff --git a/.editorconfig b/.editorconfig index 84e634d..92e783f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,3 +2,6 @@ # CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. dotnet_diagnostic.CS8632.severity = suggestion + +# CS4014: Because this call is not awaited, execution of the current method continues before the call is completed +dotnet_diagnostic.CS4014.severity = suggestion diff --git a/.vs/WindowsFormsApplication2/v16/.suo b/.vs/WindowsFormsApplication2/v16/.suo index d0dc4e6..efc3a58 100644 Binary files a/.vs/WindowsFormsApplication2/v16/.suo and b/.vs/WindowsFormsApplication2/v16/.suo differ diff --git a/WindowsFormsApplication2/Form1.Designer.cs b/WindowsFormsApplication2/Form1.Designer.cs index 99f8550..4a8d621 100644 --- a/WindowsFormsApplication2/Form1.Designer.cs +++ b/WindowsFormsApplication2/Form1.Designer.cs @@ -45,15 +45,16 @@ this.debugToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.testConsoleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.writeLabelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.listBox1 = new System.Windows.Forms.ListBox(); this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.showToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.quitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); - this.checkBox1 = new System.Windows.Forms.CheckBox(); - this.label1 = new System.Windows.Forms.Label(); + this.listBox1 = new System.Windows.Forms.ListBox(); + this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.menuStrip1.SuspendLayout(); this.contextMenuStrip1.SuspendLayout(); + this.statusStrip1.SuspendLayout(); this.SuspendLayout(); // // menuStrip1 @@ -155,7 +156,7 @@ // aboutToolStripMenuItem // this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; - this.aboutToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(107, 22); this.aboutToolStripMenuItem.Text = "About"; this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); // @@ -182,14 +183,6 @@ this.writeLabelToolStripMenuItem.Text = "Write Status"; this.writeLabelToolStripMenuItem.Click += new System.EventHandler(this.writeLabelToolStripMenuItem_Click); // - // listBox1 - // - this.listBox1.Location = new System.Drawing.Point(14, 27); - this.listBox1.Name = "listBox1"; - this.listBox1.Size = new System.Drawing.Size(475, 199); - this.listBox1.TabIndex = 1; - this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged); - // // notifyIcon1 // this.notifyIcon1.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info; @@ -225,36 +218,40 @@ this.quitToolStripMenuItem1.Text = "Quit"; this.quitToolStripMenuItem1.Click += new System.EventHandler(this.quitToolStripMenuItem1_Click); // - // checkBox1 + // listBox1 // - this.checkBox1.AutoSize = true; - this.checkBox1.Location = new System.Drawing.Point(397, 238); - this.checkBox1.Name = "checkBox1"; - this.checkBox1.Size = new System.Drawing.Size(94, 17); - this.checkBox1.TabIndex = 4; - this.checkBox1.Text = "Show Console"; - this.checkBox1.UseVisualStyleBackColor = true; - this.checkBox1.Click += new System.EventHandler(this.checkBox1_Click); + this.listBox1.FormattingEnabled = true; + this.listBox1.Items.AddRange(new object[] { + " "}); + this.listBox1.Location = new System.Drawing.Point(12, 27); + this.listBox1.Name = "listBox1"; + this.listBox1.Size = new System.Drawing.Size(479, 199); + this.listBox1.TabIndex = 5; // - // label1 + // statusStrip1 // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 242); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(35, 13); - this.label1.TabIndex = 3; - this.label1.Text = "label1"; + this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripStatusLabel1}); + this.statusStrip1.Location = new System.Drawing.Point(0, 242); + this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.Size = new System.Drawing.Size(503, 22); + this.statusStrip1.TabIndex = 6; + this.statusStrip1.Text = "statusStrip1"; + // + // toolStripStatusLabel1 + // + this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; + this.toolStripStatusLabel1.Size = new System.Drawing.Size(103, 17); + this.toolStripStatusLabel1.Text = "Status Unavailable"; + this.toolStripStatusLabel1.Click += new System.EventHandler(this.toolStripStatusLabel1_Click); // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.AutoSize = true; - this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.ClientSize = new System.Drawing.Size(503, 264); + this.Controls.Add(this.statusStrip1); this.Controls.Add(this.listBox1); - this.Controls.Add(this.label1); - this.Controls.Add(this.checkBox1); this.Controls.Add(this.menuStrip1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MainMenuStrip = this.menuStrip1; @@ -268,6 +265,8 @@ this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); this.contextMenuStrip1.ResumeLayout(false); + this.statusStrip1.ResumeLayout(false); + this.statusStrip1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -291,12 +290,12 @@ private System.Windows.Forms.ToolStripMenuItem quitToolStripMenuItem1; private System.Windows.Forms.ToolStripMenuItem openToTrayToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem rPCSettingsToolStripMenuItem; - public System.Windows.Forms.ListBox listBox1; private System.Windows.Forms.ToolStripMenuItem debugToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem testConsoleToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem writeLabelToolStripMenuItem; - public System.Windows.Forms.Label label1; - private System.Windows.Forms.CheckBox checkBox1; + private System.Windows.Forms.ListBox listBox1; + public System.Windows.Forms.StatusStrip statusStrip1; + public System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; } } diff --git a/WindowsFormsApplication2/Form1.cs b/WindowsFormsApplication2/Form1.cs index aba2656..e28361e 100644 --- a/WindowsFormsApplication2/Form1.cs +++ b/WindowsFormsApplication2/Form1.cs @@ -7,6 +7,7 @@ using System.Linq; using System.IO; using System.Text; using System.Windows.Forms; +using System.Collections; namespace JellyfinRPC { @@ -81,17 +82,32 @@ namespace JellyfinRPC { try { - if (!listBox1.Items.Contains((object)ConsoleManager.lineToWrite)) + + + + string last = listBox1.Items[listBox1.Items.Count - 1].ToString(); + + if (last == ConsoleManager.lineToWrite) + { + return; + } + else { listBox1.BeginInvoke((MethodInvoker)delegate { - listBox1.Items.Add(ConsoleManager.lineToWrite); + if (ConsoleManager.lineToWrite != null) + { + listBox1.Items.Add(ConsoleManager.lineToWrite); + } + + }); - - } + + + } - catch (ArgumentNullException) + catch (NullReferenceException) { return; } @@ -182,9 +198,10 @@ namespace JellyfinRPC StatusManager.WriteStatusLine("Testing Status..."); } - private void checkBox1_Click(object sender, EventArgs e) + + private void toolStripStatusLabel1_Click(object sender, EventArgs e) { - listBox1.Enabled = checkBox1.Checked; + } } } diff --git a/WindowsFormsApplication2/Form1.resx b/WindowsFormsApplication2/Form1.resx index f1885cc..3b623a3 100644 --- a/WindowsFormsApplication2/Form1.resx +++ b/WindowsFormsApplication2/Form1.resx @@ -245,6 +245,9 @@ AAAIEAAAAAAAAIABAACAAQAAwAMAAMADAADgBwAA4AcAAPAPAAD4HwAA+B8AAPw/AAA= + + 410, 27 + 62 diff --git a/WindowsFormsApplication2/StatusManager.cs b/WindowsFormsApplication2/StatusManager.cs index f4f0681..932b437 100644 --- a/WindowsFormsApplication2/StatusManager.cs +++ b/WindowsFormsApplication2/StatusManager.cs @@ -11,7 +11,7 @@ namespace JellyfinRPC public static void WriteStatusLine(string Status) { MainForm = new Form1(); - MainForm.label1.Text = $"Current Status - {Status}"; + MainForm.toolStripStatusLabel1.Text = $"Current Status - {Status}"; } } } diff --git a/WindowsFormsApplication2/bin/Debug/Jellyfin Rich Presence.exe b/WindowsFormsApplication2/bin/Debug/Jellyfin Rich Presence.exe index 9874cad..3f0e242 100644 Binary files a/WindowsFormsApplication2/bin/Debug/Jellyfin Rich Presence.exe and b/WindowsFormsApplication2/bin/Debug/Jellyfin Rich Presence.exe differ diff --git a/WindowsFormsApplication2/bin/Debug/Jellyfin Rich Presence.pdb b/WindowsFormsApplication2/bin/Debug/Jellyfin Rich Presence.pdb index 8800372..26b3276 100644 Binary files a/WindowsFormsApplication2/bin/Debug/Jellyfin Rich Presence.pdb and b/WindowsFormsApplication2/bin/Debug/Jellyfin Rich Presence.pdb differ diff --git a/WindowsFormsApplication2/obj/x86/Debug/Jellyfin Rich Presence.exe b/WindowsFormsApplication2/obj/x86/Debug/Jellyfin Rich Presence.exe index 9874cad..3f0e242 100644 Binary files a/WindowsFormsApplication2/obj/x86/Debug/Jellyfin Rich Presence.exe and b/WindowsFormsApplication2/obj/x86/Debug/Jellyfin Rich Presence.exe differ diff --git a/WindowsFormsApplication2/obj/x86/Debug/Jellyfin Rich Presence.pdb b/WindowsFormsApplication2/obj/x86/Debug/Jellyfin Rich Presence.pdb index 8800372..26b3276 100644 Binary files a/WindowsFormsApplication2/obj/x86/Debug/Jellyfin Rich Presence.pdb and b/WindowsFormsApplication2/obj/x86/Debug/Jellyfin Rich Presence.pdb differ diff --git a/WindowsFormsApplication2/obj/x86/Debug/JellyfinRPCGUI.csproj.GenerateResource.Cache b/WindowsFormsApplication2/obj/x86/Debug/JellyfinRPCGUI.csproj.GenerateResource.Cache index d4bd15b..7114dfa 100644 Binary files a/WindowsFormsApplication2/obj/x86/Debug/JellyfinRPCGUI.csproj.GenerateResource.Cache and b/WindowsFormsApplication2/obj/x86/Debug/JellyfinRPCGUI.csproj.GenerateResource.Cache differ