From 88e84f74e1c352b5e24b088ba31cff9eb39964fb Mon Sep 17 00:00:00 2001 From: Aren Date: Sun, 12 Feb 2017 15:57:25 +0100 Subject: [PATCH] Added basic discord integration, please improve UI, someone --- .../Applications/Discord.Designer.cs | 71 +++++++++++ ShiftOS.WinForms/Applications/Discord.cs | 71 +++++++++++ ShiftOS.WinForms/Applications/Discord.resx | 120 ++++++++++++++++++ ShiftOS.WinForms/ShiftOS.WinForms.csproj | 9 ++ 4 files changed, 271 insertions(+) create mode 100644 ShiftOS.WinForms/Applications/Discord.Designer.cs create mode 100644 ShiftOS.WinForms/Applications/Discord.cs create mode 100644 ShiftOS.WinForms/Applications/Discord.resx diff --git a/ShiftOS.WinForms/Applications/Discord.Designer.cs b/ShiftOS.WinForms/Applications/Discord.Designer.cs new file mode 100644 index 0000000..5b1c52d --- /dev/null +++ b/ShiftOS.WinForms/Applications/Discord.Designer.cs @@ -0,0 +1,71 @@ +namespace ShiftOS.WinForms.Applications +{ + partial class Discord + { + /// + /// 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 Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.button1 = new System.Windows.Forms.Button(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(162, 168); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(91, 23); + this.button1.TabIndex = 0; + this.button1.Text = "Send Message"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(135, 93); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(146, 20); + this.textBox1.TabIndex = 1; + // + // Discord + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.Black; + this.Controls.Add(this.textBox1); + this.Controls.Add(this.button1); + this.Name = "Discord"; + this.Size = new System.Drawing.Size(446, 271); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button button1; + private System.Windows.Forms.TextBox textBox1; + } +} diff --git a/ShiftOS.WinForms/Applications/Discord.cs b/ShiftOS.WinForms/Applications/Discord.cs new file mode 100644 index 0000000..cfce55f --- /dev/null +++ b/ShiftOS.WinForms/Applications/Discord.cs @@ -0,0 +1,71 @@ +/* + * MIT License + * + * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Net; +using System.IO; +using ShiftOS.Engine; +using System.Windows.Forms; + +namespace ShiftOS.WinForms.Applications +{ + [Launcher("Discord", false, null, "Networking")] + public partial class Discord : UserControl, IShiftOSWindow + { + public void OnUpgrade() + { + } + + public void OnSkinLoad() + { + } + + public void OnLoad() + { + } + + public bool OnUnload() + { + return true; + } + + public Discord() + { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) + { + WebRequest sendMessageRequest = WebRequest.Create("http://selfbot-areno.rhcloud.com/send/[" + SaveSystem.CurrentSave.Username + "@" + SaveSystem.CurrentSave.SystemName + "]: " + this.textBox1.Text); + sendMessageRequest.GetResponse(); // It doesn't actually send the request until you use GetResponse() + } + } +} diff --git a/ShiftOS.WinForms/Applications/Discord.resx b/ShiftOS.WinForms/Applications/Discord.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/Applications/Discord.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index f566870..9212406 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -87,6 +87,12 @@ Dialog.cs + + UserControl + + + Discord.cs + UserControl @@ -241,6 +247,9 @@ Dialog.cs + + Discord.cs + Downloader.cs