WIP
This commit is contained in:
parent
3e4b5135c5
commit
2c913e194a
26
App.config
26
App.config
|
@ -1,7 +1,31 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||||
</startup>
|
</startup>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Diagnostics.Tracing" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Runtime.InteropServices" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.IO;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace RDP_Portal {
|
||||||
|
public class Config {
|
||||||
|
|
||||||
|
private static Config? _instance;
|
||||||
|
public static string filename = "config.json";
|
||||||
|
public static string rdpDir = "rdp-files";
|
||||||
|
|
||||||
|
public static Config GetConfig() {
|
||||||
|
if (!File.Exists(filename)) {
|
||||||
|
File.AppendAllText(filename, "{}");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Directory.Exists(rdpDir)) {
|
||||||
|
Directory.CreateDirectory(rdpDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
var json = File.ReadAllText(filename);
|
||||||
|
|
||||||
|
_instance = JsonConvert.DeserializeObject<Config>(json);
|
||||||
|
|
||||||
|
if (_instance == null) {
|
||||||
|
throw new Exception("Cannot read config.json");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_instance.Profiles == null) {
|
||||||
|
_instance.Profiles = new BindingList<Profile>();
|
||||||
|
_instance.Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BindingList<Profile> Profiles { get; set; }
|
||||||
|
|
||||||
|
public bool KeepOpening { get; set; } = true;
|
||||||
|
|
||||||
|
public void Save() {
|
||||||
|
var json = JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||||
|
File.WriteAllText(filename, json);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -25,49 +25,42 @@
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent() {
|
private void InitializeComponent() {
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
||||||
this.listBox1 = new System.Windows.Forms.ListBox();
|
this.checkBoxKeepOpening = new System.Windows.Forms.CheckBox();
|
||||||
this.checkBox1 = new System.Windows.Forms.CheckBox();
|
|
||||||
this.button1 = new System.Windows.Forms.Button();
|
this.button1 = new System.Windows.Forms.Button();
|
||||||
this.button2 = new System.Windows.Forms.Button();
|
this.buttonConnect = new System.Windows.Forms.Button();
|
||||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
this.textBoxComputer = new System.Windows.Forms.TextBox();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
this.label3 = new System.Windows.Forms.Label();
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
this.label4 = new System.Windows.Forms.Label();
|
this.label4 = new System.Windows.Forms.Label();
|
||||||
this.button3 = new System.Windows.Forms.Button();
|
this.buttonNew = new System.Windows.Forms.Button();
|
||||||
this.textBox2 = new System.Windows.Forms.TextBox();
|
this.textBoxUsername = new System.Windows.Forms.TextBox();
|
||||||
this.textBox3 = new System.Windows.Forms.TextBox();
|
this.textBoxPassword = new System.Windows.Forms.TextBox();
|
||||||
this.textBox4 = new System.Windows.Forms.TextBox();
|
this.textBoxDomain = new System.Windows.Forms.TextBox();
|
||||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||||
this.button4 = new System.Windows.Forms.Button();
|
this.buttonSave = new System.Windows.Forms.Button();
|
||||||
this.button5 = new System.Windows.Forms.Button();
|
this.buttonDelete = new System.Windows.Forms.Button();
|
||||||
this.buttonMoreOptions = new System.Windows.Forms.Button();
|
this.buttonOptions = new System.Windows.Forms.Button();
|
||||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||||
|
this.buttonCancel = new System.Windows.Forms.Button();
|
||||||
|
this.buttonEdit = new System.Windows.Forms.Button();
|
||||||
|
this.textBoxName = new System.Windows.Forms.TextBox();
|
||||||
|
this.listBox = new System.Windows.Forms.ListBox();
|
||||||
this.groupBox1.SuspendLayout();
|
this.groupBox1.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// listBox1
|
// checkBoxKeepOpening
|
||||||
//
|
//
|
||||||
this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left)));
|
this.checkBoxKeepOpening.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.listBox1.FormattingEnabled = true;
|
this.checkBoxKeepOpening.Location = new System.Drawing.Point(13, 432);
|
||||||
this.listBox1.ItemHeight = 16;
|
this.checkBoxKeepOpening.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.listBox1.Location = new System.Drawing.Point(13, 107);
|
this.checkBoxKeepOpening.Name = "checkBoxKeepOpening";
|
||||||
this.listBox1.Margin = new System.Windows.Forms.Padding(4);
|
this.checkBoxKeepOpening.Size = new System.Drawing.Size(367, 30);
|
||||||
this.listBox1.Name = "listBox1";
|
this.checkBoxKeepOpening.TabIndex = 1;
|
||||||
this.listBox1.Size = new System.Drawing.Size(211, 276);
|
this.checkBoxKeepOpening.Text = "Keep opening RDP Portal";
|
||||||
this.listBox1.TabIndex = 0;
|
this.checkBoxKeepOpening.UseVisualStyleBackColor = true;
|
||||||
//
|
this.checkBoxKeepOpening.CheckedChanged += new System.EventHandler(this.checkBoxKeepOpening_CheckedChanged);
|
||||||
// checkBox1
|
|
||||||
//
|
|
||||||
this.checkBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
||||||
this.checkBox1.Location = new System.Drawing.Point(13, 432);
|
|
||||||
this.checkBox1.Margin = new System.Windows.Forms.Padding(4);
|
|
||||||
this.checkBox1.Name = "checkBox1";
|
|
||||||
this.checkBox1.Size = new System.Drawing.Size(367, 30);
|
|
||||||
this.checkBox1.TabIndex = 1;
|
|
||||||
this.checkBox1.Text = "Keep opening RDP Portal";
|
|
||||||
this.checkBox1.UseVisualStyleBackColor = true;
|
|
||||||
//
|
//
|
||||||
// button1
|
// button1
|
||||||
//
|
//
|
||||||
|
@ -80,25 +73,26 @@
|
||||||
this.button1.Text = "About";
|
this.button1.Text = "About";
|
||||||
this.button1.UseVisualStyleBackColor = true;
|
this.button1.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// button2
|
// buttonConnect
|
||||||
//
|
//
|
||||||
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonConnect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.button2.Location = new System.Drawing.Point(379, 432);
|
this.buttonConnect.Location = new System.Drawing.Point(358, 432);
|
||||||
this.button2.Margin = new System.Windows.Forms.Padding(4);
|
this.buttonConnect.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.button2.Name = "button2";
|
this.buttonConnect.Name = "buttonConnect";
|
||||||
this.button2.Size = new System.Drawing.Size(100, 28);
|
this.buttonConnect.Size = new System.Drawing.Size(121, 28);
|
||||||
this.button2.TabIndex = 3;
|
this.buttonConnect.TabIndex = 3;
|
||||||
this.button2.Text = "Connect";
|
this.buttonConnect.Text = "Connect";
|
||||||
this.button2.UseVisualStyleBackColor = true;
|
this.buttonConnect.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonConnect.Click += new System.EventHandler(this.buttonConnect_Click);
|
||||||
//
|
//
|
||||||
// textBox1
|
// textBoxComputer
|
||||||
//
|
//
|
||||||
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)));
|
this.textBoxComputer.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.textBox1.Location = new System.Drawing.Point(123, 32);
|
this.textBoxComputer.Location = new System.Drawing.Point(123, 32);
|
||||||
this.textBox1.Margin = new System.Windows.Forms.Padding(4);
|
this.textBoxComputer.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.textBox1.Name = "textBox1";
|
this.textBoxComputer.Name = "textBoxComputer";
|
||||||
this.textBox1.Size = new System.Drawing.Size(209, 22);
|
this.textBoxComputer.Size = new System.Drawing.Size(209, 22);
|
||||||
this.textBox1.TabIndex = 4;
|
this.textBoxComputer.TabIndex = 4;
|
||||||
//
|
//
|
||||||
// label1
|
// label1
|
||||||
//
|
//
|
||||||
|
@ -136,56 +130,58 @@
|
||||||
this.label4.TabIndex = 8;
|
this.label4.TabIndex = 8;
|
||||||
this.label4.Text = "Domain:";
|
this.label4.Text = "Domain:";
|
||||||
//
|
//
|
||||||
// button3
|
// buttonNew
|
||||||
//
|
//
|
||||||
this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.buttonNew.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.button3.Location = new System.Drawing.Point(13, 396);
|
this.buttonNew.Location = new System.Drawing.Point(13, 396);
|
||||||
this.button3.Margin = new System.Windows.Forms.Padding(4);
|
this.buttonNew.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.button3.Name = "button3";
|
this.buttonNew.Name = "buttonNew";
|
||||||
this.button3.Size = new System.Drawing.Size(103, 28);
|
this.buttonNew.Size = new System.Drawing.Size(103, 28);
|
||||||
this.button3.TabIndex = 9;
|
this.buttonNew.TabIndex = 9;
|
||||||
this.button3.Text = "New";
|
this.buttonNew.Text = "New";
|
||||||
this.button3.UseVisualStyleBackColor = true;
|
this.buttonNew.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonNew.Click += new System.EventHandler(this.buttonNew_Click);
|
||||||
//
|
//
|
||||||
// textBox2
|
// textBoxUsername
|
||||||
//
|
//
|
||||||
this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)));
|
this.textBoxUsername.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.textBox2.Location = new System.Drawing.Point(123, 69);
|
this.textBoxUsername.Location = new System.Drawing.Point(123, 69);
|
||||||
this.textBox2.Margin = new System.Windows.Forms.Padding(4);
|
this.textBoxUsername.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.textBox2.Name = "textBox2";
|
this.textBoxUsername.Name = "textBoxUsername";
|
||||||
this.textBox2.Size = new System.Drawing.Size(209, 22);
|
this.textBoxUsername.Size = new System.Drawing.Size(209, 22);
|
||||||
this.textBox2.TabIndex = 10;
|
this.textBoxUsername.TabIndex = 10;
|
||||||
//
|
//
|
||||||
// textBox3
|
// textBoxPassword
|
||||||
//
|
//
|
||||||
this.textBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)));
|
this.textBoxPassword.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.textBox3.Location = new System.Drawing.Point(124, 106);
|
this.textBoxPassword.Location = new System.Drawing.Point(124, 106);
|
||||||
this.textBox3.Margin = new System.Windows.Forms.Padding(4);
|
this.textBoxPassword.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.textBox3.Name = "textBox3";
|
this.textBoxPassword.Name = "textBoxPassword";
|
||||||
this.textBox3.Size = new System.Drawing.Size(208, 22);
|
this.textBoxPassword.Size = new System.Drawing.Size(208, 22);
|
||||||
this.textBox3.TabIndex = 11;
|
this.textBoxPassword.TabIndex = 11;
|
||||||
|
this.textBoxPassword.UseSystemPasswordChar = true;
|
||||||
//
|
//
|
||||||
// textBox4
|
// textBoxDomain
|
||||||
//
|
//
|
||||||
this.textBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)));
|
this.textBoxDomain.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.textBox4.Location = new System.Drawing.Point(124, 143);
|
this.textBoxDomain.Location = new System.Drawing.Point(124, 143);
|
||||||
this.textBox4.Margin = new System.Windows.Forms.Padding(4);
|
this.textBoxDomain.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.textBox4.Name = "textBox4";
|
this.textBoxDomain.Name = "textBoxDomain";
|
||||||
this.textBox4.Size = new System.Drawing.Size(208, 22);
|
this.textBoxDomain.Size = new System.Drawing.Size(208, 22);
|
||||||
this.textBox4.TabIndex = 12;
|
this.textBoxDomain.TabIndex = 12;
|
||||||
//
|
//
|
||||||
// groupBox1
|
// groupBox1
|
||||||
//
|
//
|
||||||
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)));
|
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.groupBox1.Controls.Add(this.label3);
|
this.groupBox1.Controls.Add(this.label3);
|
||||||
this.groupBox1.Controls.Add(this.textBox4);
|
this.groupBox1.Controls.Add(this.textBoxDomain);
|
||||||
this.groupBox1.Controls.Add(this.textBox1);
|
this.groupBox1.Controls.Add(this.textBoxComputer);
|
||||||
this.groupBox1.Controls.Add(this.textBox3);
|
this.groupBox1.Controls.Add(this.textBoxPassword);
|
||||||
this.groupBox1.Controls.Add(this.label1);
|
this.groupBox1.Controls.Add(this.label1);
|
||||||
this.groupBox1.Controls.Add(this.textBox2);
|
this.groupBox1.Controls.Add(this.textBoxUsername);
|
||||||
this.groupBox1.Controls.Add(this.label2);
|
this.groupBox1.Controls.Add(this.label2);
|
||||||
this.groupBox1.Controls.Add(this.label4);
|
this.groupBox1.Controls.Add(this.label4);
|
||||||
this.groupBox1.Location = new System.Drawing.Point(234, 107);
|
this.groupBox1.Location = new System.Drawing.Point(234, 141);
|
||||||
this.groupBox1.Margin = new System.Windows.Forms.Padding(4);
|
this.groupBox1.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.groupBox1.Name = "groupBox1";
|
this.groupBox1.Name = "groupBox1";
|
||||||
this.groupBox1.Padding = new System.Windows.Forms.Padding(4);
|
this.groupBox1.Padding = new System.Windows.Forms.Padding(4);
|
||||||
|
@ -194,37 +190,40 @@
|
||||||
this.groupBox1.TabStop = false;
|
this.groupBox1.TabStop = false;
|
||||||
this.groupBox1.Text = "Connection";
|
this.groupBox1.Text = "Connection";
|
||||||
//
|
//
|
||||||
// button4
|
// buttonSave
|
||||||
//
|
//
|
||||||
this.button4.Location = new System.Drawing.Point(232, 305);
|
this.buttonSave.Location = new System.Drawing.Point(232, 339);
|
||||||
this.button4.Margin = new System.Windows.Forms.Padding(4);
|
this.buttonSave.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.button4.Name = "button4";
|
this.buttonSave.Name = "buttonSave";
|
||||||
this.button4.Size = new System.Drawing.Size(100, 28);
|
this.buttonSave.Size = new System.Drawing.Size(100, 28);
|
||||||
this.button4.TabIndex = 14;
|
this.buttonSave.TabIndex = 14;
|
||||||
this.button4.Text = "Save";
|
this.buttonSave.Text = "Save";
|
||||||
this.button4.UseVisualStyleBackColor = true;
|
this.buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonSave.Click += new System.EventHandler(this.buttonSave_Click);
|
||||||
//
|
//
|
||||||
// button5
|
// buttonDelete
|
||||||
//
|
//
|
||||||
this.button5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.buttonDelete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.button5.Location = new System.Drawing.Point(124, 396);
|
this.buttonDelete.Location = new System.Drawing.Point(124, 396);
|
||||||
this.button5.Margin = new System.Windows.Forms.Padding(4);
|
this.buttonDelete.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.button5.Name = "button5";
|
this.buttonDelete.Name = "buttonDelete";
|
||||||
this.button5.Size = new System.Drawing.Size(100, 28);
|
this.buttonDelete.Size = new System.Drawing.Size(100, 28);
|
||||||
this.button5.TabIndex = 15;
|
this.buttonDelete.TabIndex = 15;
|
||||||
this.button5.Text = "Delete";
|
this.buttonDelete.Text = "Delete";
|
||||||
this.button5.UseVisualStyleBackColor = true;
|
this.buttonDelete.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonDelete.Click += new System.EventHandler(this.buttonDelete_Click);
|
||||||
//
|
//
|
||||||
// buttonMoreOptions
|
// buttonOptions
|
||||||
//
|
//
|
||||||
this.buttonMoreOptions.Location = new System.Drawing.Point(340, 305);
|
this.buttonOptions.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonMoreOptions.Margin = new System.Windows.Forms.Padding(4);
|
this.buttonOptions.Location = new System.Drawing.Point(487, 339);
|
||||||
this.buttonMoreOptions.Name = "buttonMoreOptions";
|
this.buttonOptions.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.buttonMoreOptions.Size = new System.Drawing.Size(232, 28);
|
this.buttonOptions.Name = "buttonOptions";
|
||||||
this.buttonMoreOptions.TabIndex = 16;
|
this.buttonOptions.Size = new System.Drawing.Size(100, 28);
|
||||||
this.buttonMoreOptions.Text = "Show External RDP Options";
|
this.buttonOptions.TabIndex = 16;
|
||||||
this.buttonMoreOptions.UseVisualStyleBackColor = true;
|
this.buttonOptions.Text = "Options";
|
||||||
this.buttonMoreOptions.Click += new System.EventHandler(this.buttonMoreOptions_Click);
|
this.buttonOptions.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonOptions.Click += new System.EventHandler(this.buttonMoreOptions_Click);
|
||||||
//
|
//
|
||||||
// pictureBox1
|
// pictureBox1
|
||||||
//
|
//
|
||||||
|
@ -237,61 +236,119 @@
|
||||||
this.pictureBox1.TabIndex = 17;
|
this.pictureBox1.TabIndex = 17;
|
||||||
this.pictureBox1.TabStop = false;
|
this.pictureBox1.TabStop = false;
|
||||||
//
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
this.buttonCancel.Location = new System.Drawing.Point(340, 339);
|
||||||
|
this.buttonCancel.Margin = new System.Windows.Forms.Padding(4);
|
||||||
|
this.buttonCancel.Name = "buttonCancel";
|
||||||
|
this.buttonCancel.Size = new System.Drawing.Size(100, 28);
|
||||||
|
this.buttonCancel.TabIndex = 18;
|
||||||
|
this.buttonCancel.Text = "Cancel";
|
||||||
|
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
|
||||||
|
//
|
||||||
|
// buttonEdit
|
||||||
|
//
|
||||||
|
this.buttonEdit.Location = new System.Drawing.Point(232, 339);
|
||||||
|
this.buttonEdit.Margin = new System.Windows.Forms.Padding(4);
|
||||||
|
this.buttonEdit.Name = "buttonEdit";
|
||||||
|
this.buttonEdit.Size = new System.Drawing.Size(100, 28);
|
||||||
|
this.buttonEdit.TabIndex = 19;
|
||||||
|
this.buttonEdit.Text = "Edit";
|
||||||
|
this.buttonEdit.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonEdit.Click += new System.EventHandler(this.buttonEdit_Click);
|
||||||
|
//
|
||||||
|
// textBoxName
|
||||||
|
//
|
||||||
|
this.textBoxName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.textBoxName.Location = new System.Drawing.Point(234, 107);
|
||||||
|
this.textBoxName.Margin = new System.Windows.Forms.Padding(4);
|
||||||
|
this.textBoxName.Name = "textBoxName";
|
||||||
|
this.textBoxName.Size = new System.Drawing.Size(353, 22);
|
||||||
|
this.textBoxName.TabIndex = 13;
|
||||||
|
//
|
||||||
|
// listBox
|
||||||
|
//
|
||||||
|
this.listBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
|
this.listBox.DisplayMember = "Name";
|
||||||
|
this.listBox.FormattingEnabled = true;
|
||||||
|
this.listBox.ItemHeight = 16;
|
||||||
|
this.listBox.Location = new System.Drawing.Point(13, 107);
|
||||||
|
this.listBox.Margin = new System.Windows.Forms.Padding(4);
|
||||||
|
this.listBox.Name = "listBox";
|
||||||
|
this.listBox.Size = new System.Drawing.Size(211, 276);
|
||||||
|
this.listBox.TabIndex = 0;
|
||||||
|
this.listBox.SelectedValueChanged += new System.EventHandler(this.listBox_SelectedValueChanged);
|
||||||
|
//
|
||||||
// MainForm
|
// MainForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.BackColor = System.Drawing.SystemColors.Control;
|
||||||
this.ClientSize = new System.Drawing.Size(600, 473);
|
this.ClientSize = new System.Drawing.Size(600, 473);
|
||||||
|
this.Controls.Add(this.textBoxName);
|
||||||
|
this.Controls.Add(this.buttonEdit);
|
||||||
|
this.Controls.Add(this.buttonCancel);
|
||||||
this.Controls.Add(this.pictureBox1);
|
this.Controls.Add(this.pictureBox1);
|
||||||
this.Controls.Add(this.buttonMoreOptions);
|
this.Controls.Add(this.buttonOptions);
|
||||||
this.Controls.Add(this.button5);
|
this.Controls.Add(this.buttonDelete);
|
||||||
this.Controls.Add(this.button4);
|
this.Controls.Add(this.buttonSave);
|
||||||
this.Controls.Add(this.groupBox1);
|
this.Controls.Add(this.groupBox1);
|
||||||
this.Controls.Add(this.button3);
|
this.Controls.Add(this.buttonNew);
|
||||||
this.Controls.Add(this.button2);
|
this.Controls.Add(this.buttonConnect);
|
||||||
this.Controls.Add(this.button1);
|
this.Controls.Add(this.button1);
|
||||||
this.Controls.Add(this.checkBox1);
|
this.Controls.Add(this.checkBoxKeepOpening);
|
||||||
this.Controls.Add(this.listBox1);
|
this.Controls.Add(this.listBox);
|
||||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
|
this.Location = new System.Drawing.Point(15, 15);
|
||||||
this.Margin = new System.Windows.Forms.Padding(4);
|
this.Margin = new System.Windows.Forms.Padding(4);
|
||||||
this.MaximumSize = new System.Drawing.Size(900, 5528);
|
this.MaximizeBox = false;
|
||||||
this.MinimumSize = new System.Drawing.Size(600, 520);
|
this.MaximumSize = new System.Drawing.Size(618, 5528);
|
||||||
|
this.MinimumSize = new System.Drawing.Size(618, 520);
|
||||||
this.Name = "MainForm";
|
this.Name = "MainForm";
|
||||||
this.Text = "RDP Portal";
|
this.Text = "RDP Portal";
|
||||||
|
this.Load += new System.EventHandler(this.MainForm_Load);
|
||||||
this.groupBox1.ResumeLayout(false);
|
this.groupBox1.ResumeLayout(false);
|
||||||
this.groupBox1.PerformLayout();
|
this.groupBox1.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private System.Windows.Forms.TextBox textBoxName;
|
||||||
|
|
||||||
|
private System.Windows.Forms.Button buttonEdit;
|
||||||
|
|
||||||
|
private System.Windows.Forms.ListBox listBox;
|
||||||
|
|
||||||
|
private System.Windows.Forms.Button buttonCancel;
|
||||||
|
|
||||||
private System.Windows.Forms.PictureBox pictureBox1;
|
private System.Windows.Forms.PictureBox pictureBox1;
|
||||||
|
|
||||||
private System.Windows.Forms.Button buttonMoreOptions;
|
private System.Windows.Forms.Button buttonOptions;
|
||||||
|
|
||||||
private System.Windows.Forms.Button button4;
|
private System.Windows.Forms.Button buttonSave;
|
||||||
private System.Windows.Forms.Button button5;
|
private System.Windows.Forms.Button buttonDelete;
|
||||||
|
|
||||||
private System.Windows.Forms.GroupBox groupBox1;
|
private System.Windows.Forms.GroupBox groupBox1;
|
||||||
|
|
||||||
private System.Windows.Forms.TextBox textBox2;
|
private System.Windows.Forms.TextBox textBoxUsername;
|
||||||
private System.Windows.Forms.TextBox textBox3;
|
private System.Windows.Forms.TextBox textBoxPassword;
|
||||||
private System.Windows.Forms.TextBox textBox4;
|
private System.Windows.Forms.TextBox textBoxDomain;
|
||||||
|
|
||||||
private System.Windows.Forms.Button button3;
|
private System.Windows.Forms.Button buttonNew;
|
||||||
|
|
||||||
private System.Windows.Forms.TextBox textBox1;
|
private System.Windows.Forms.TextBox textBoxComputer;
|
||||||
private System.Windows.Forms.Label label1;
|
private System.Windows.Forms.Label label1;
|
||||||
private System.Windows.Forms.Label label2;
|
private System.Windows.Forms.Label label2;
|
||||||
private System.Windows.Forms.Label label3;
|
private System.Windows.Forms.Label label3;
|
||||||
private System.Windows.Forms.Label label4;
|
private System.Windows.Forms.Label label4;
|
||||||
|
|
||||||
private System.Windows.Forms.Button button2;
|
private System.Windows.Forms.Button buttonConnect;
|
||||||
|
|
||||||
private System.Windows.Forms.Button button1;
|
private System.Windows.Forms.Button button1;
|
||||||
|
|
||||||
private System.Windows.Forms.CheckBox checkBox1;
|
private System.Windows.Forms.CheckBox checkBoxKeepOpening;
|
||||||
|
|
||||||
private System.Windows.Forms.ListBox listBox1;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
146
MainForm.cs
146
MainForm.cs
|
@ -11,8 +11,49 @@ using System.Windows.Forms;
|
||||||
|
|
||||||
namespace RDP_Portal {
|
namespace RDP_Portal {
|
||||||
public partial class MainForm : Form {
|
public partial class MainForm : Form {
|
||||||
|
|
||||||
|
private Config _config;
|
||||||
|
private bool _editMode = false;
|
||||||
|
private Profile selectedProfile = null;
|
||||||
|
|
||||||
public MainForm() {
|
public MainForm() {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
_config = Config.GetConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MainForm_Load(object sender, EventArgs e) {
|
||||||
|
listBox.DataSource = _config.Profiles;
|
||||||
|
|
||||||
|
if (_config.Profiles.Count == 0) {
|
||||||
|
AddNewProfile();
|
||||||
|
}
|
||||||
|
|
||||||
|
checkBoxKeepOpening.Checked = _config.KeepOpening;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool EditMode {
|
||||||
|
get => _editMode;
|
||||||
|
set {
|
||||||
|
buttonEdit.Visible = !value;
|
||||||
|
buttonSave.Visible = value;
|
||||||
|
buttonCancel.Visible = value;
|
||||||
|
buttonOptions.Enabled = !value;
|
||||||
|
|
||||||
|
buttonConnect.Enabled = !value;
|
||||||
|
|
||||||
|
textBoxName.Enabled = value;
|
||||||
|
textBoxComputer.Enabled = value;
|
||||||
|
textBoxUsername.Enabled = value;
|
||||||
|
textBoxPassword.Enabled = value;
|
||||||
|
textBoxDomain.Enabled = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddNewProfile() {
|
||||||
|
var profile = new Profile();
|
||||||
|
profile.JustAdded = true;
|
||||||
|
_config.Profiles.Add(profile);
|
||||||
|
listBox.SelectedIndex = _config.Profiles.Count - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonMoreOptions_Click(object sender, EventArgs e) {
|
private void buttonMoreOptions_Click(object sender, EventArgs e) {
|
||||||
|
@ -20,7 +61,7 @@ namespace RDP_Portal {
|
||||||
CreateNoWindow = false,
|
CreateNoWindow = false,
|
||||||
UseShellExecute = false,
|
UseShellExecute = false,
|
||||||
FileName = "mstsc.exe",
|
FileName = "mstsc.exe",
|
||||||
Arguments = "/edit test.rdp"
|
Arguments = "/edit " + GetSelectedProfile().Filename,
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -30,5 +71,108 @@ namespace RDP_Portal {
|
||||||
MessageBox.Show(ex.ToString());
|
MessageBox.Show(ex.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void buttonConnect_Click(object sender, EventArgs e) {
|
||||||
|
GetSelectedProfile().PrepareRdpFile();
|
||||||
|
|
||||||
|
ProcessStartInfo startInfo = new ProcessStartInfo {
|
||||||
|
CreateNoWindow = false,
|
||||||
|
UseShellExecute = false,
|
||||||
|
FileName = "mstsc.exe",
|
||||||
|
Arguments = GetSelectedProfile().Filename,
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
var exeProcess = Process.Start(startInfo) ?? throw new InvalidOperationException();
|
||||||
|
exeProcess.WaitForExit();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
MessageBox.Show(ex.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void listBox_SelectedValueChanged(object sender, EventArgs e) {
|
||||||
|
SelectProfile();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Profile GetSelectedProfile() {
|
||||||
|
return (Profile) listBox.SelectedItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SelectProfile(bool force = false) {
|
||||||
|
var profile = (Profile) listBox.SelectedItem;
|
||||||
|
|
||||||
|
// Avoid click empty area reset value
|
||||||
|
if (profile == selectedProfile && !force) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
selectedProfile = profile;
|
||||||
|
|
||||||
|
EditMode = profile.JustAdded;
|
||||||
|
|
||||||
|
textBoxName.Text = profile.Name ;
|
||||||
|
textBoxComputer.Text = profile.Computer;
|
||||||
|
textBoxUsername.Text = profile.Username ;
|
||||||
|
textBoxPassword.Text = profile.Password;
|
||||||
|
textBoxDomain.Text = profile.Domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonEdit_Click(object sender, EventArgs e) {
|
||||||
|
EditMode = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonCancel_Click(object sender, EventArgs e) {
|
||||||
|
EditMode = false;
|
||||||
|
|
||||||
|
var profile = GetSelectedProfile();
|
||||||
|
|
||||||
|
if (profile.JustAdded && _config.Profiles.Count > 1) {
|
||||||
|
buttonDelete_Click(null, null);
|
||||||
|
} else {
|
||||||
|
SelectProfile(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonNew_Click(object sender, EventArgs e) {
|
||||||
|
AddNewProfile();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonDelete_Click(object sender, EventArgs e) {
|
||||||
|
var selectedItems = (Profile) listBox.SelectedItem;
|
||||||
|
selectedItems.Delete();
|
||||||
|
_config.Profiles.Remove(selectedItems);
|
||||||
|
_config.Save();
|
||||||
|
if (_config.Profiles.Count == 0) {
|
||||||
|
AddNewProfile();
|
||||||
|
SelectProfile(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonSave_Click(object sender, EventArgs e) {
|
||||||
|
var profile = (Profile) listBox.SelectedItem;
|
||||||
|
|
||||||
|
profile.JustAdded = false;
|
||||||
|
|
||||||
|
profile.Name = textBoxName.Text;
|
||||||
|
profile.Computer = textBoxComputer.Text;
|
||||||
|
profile.Username = textBoxUsername.Text;
|
||||||
|
profile.Password = textBoxPassword.Text;
|
||||||
|
profile.Domain = textBoxDomain.Text;
|
||||||
|
|
||||||
|
profile.PrepareRdpFile();
|
||||||
|
|
||||||
|
_config.Save();
|
||||||
|
EditMode = false;
|
||||||
|
|
||||||
|
// Refresh the list
|
||||||
|
listBox.DisplayMember = null;
|
||||||
|
listBox.DisplayMember = "Name";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkBoxKeepOpening_CheckedChanged(object sender, EventArgs e) {
|
||||||
|
_config.KeepOpening = checkBoxKeepOpening.Checked;
|
||||||
|
_config.Save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,99 @@
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace RDP_Portal {
|
||||||
|
public class Profile {
|
||||||
|
private string _name = "";
|
||||||
|
|
||||||
|
public string Name {
|
||||||
|
get {
|
||||||
|
if (_name == "") {
|
||||||
|
return "<New Profile>";
|
||||||
|
}
|
||||||
|
return _name;
|
||||||
|
}
|
||||||
|
set => _name = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Filename { get; set; } = "";
|
||||||
|
public string Computer { get; set; }
|
||||||
|
public string Username { get; set; }
|
||||||
|
|
||||||
|
public string EncryptedPassword { get; set; } = "";
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public string Password {
|
||||||
|
get {
|
||||||
|
if (EncryptedPassword == "") {
|
||||||
|
return EncryptedPassword;
|
||||||
|
}
|
||||||
|
return EncryptedPassword.Decrypt();
|
||||||
|
}
|
||||||
|
set => EncryptedPassword = value.Encrypt();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Domain { get; set; }
|
||||||
|
|
||||||
|
public void PrepareRdpFile() {
|
||||||
|
var justCreated = false;
|
||||||
|
|
||||||
|
if (Filename == null || Filename == "") {
|
||||||
|
String name;
|
||||||
|
while (true) {
|
||||||
|
name = Config.rdpDir + "\\" + StringUtil.GenerateName(8) + ".rdp";
|
||||||
|
if (!File.Exists(name)) {
|
||||||
|
var file = File.Create(name);
|
||||||
|
file.Close();
|
||||||
|
justCreated = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Filename = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!File.Exists(Filename)) {
|
||||||
|
var file = File.Create(Filename);
|
||||||
|
file.Close();
|
||||||
|
justCreated = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var writer = File.AppendText(Filename);
|
||||||
|
|
||||||
|
if (Computer != "") {
|
||||||
|
writer.WriteLine("full address:s:" + Computer);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Username != "") {
|
||||||
|
writer.WriteLine("username:s:" + Username);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Password != "") {
|
||||||
|
// TODO
|
||||||
|
writer.WriteLine("password 51:b:" + Password);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Domain != "") {
|
||||||
|
writer.WriteLine("domain:s:" + Domain);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (justCreated) {
|
||||||
|
writer.WriteLine("authentication level:i:0");
|
||||||
|
writer.WriteLine("prompt for credentials:i:0");
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonIgnore] public bool JustAdded { get; set; } = false;
|
||||||
|
|
||||||
|
public void Delete() {
|
||||||
|
try {
|
||||||
|
File.Delete(Filename);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
namespace RDP_Portal {
|
||||||
|
public class RdpFile {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
public static class StringUtil {
|
||||||
|
private static byte[] key = new byte[8] {226, 175, 129, 22, 187, 4, 143, 171};
|
||||||
|
private static byte[] iv = new byte[8] {181, 239, 77, 174, 238, 148, 206, 164};
|
||||||
|
|
||||||
|
public static string Encrypt(this string text) {
|
||||||
|
SymmetricAlgorithm algorithm = DES.Create();
|
||||||
|
ICryptoTransform transform = algorithm.CreateEncryptor(key, iv);
|
||||||
|
byte[] inputbuffer = Encoding.Unicode.GetBytes(text);
|
||||||
|
byte[] outputBuffer = transform.TransformFinalBlock(inputbuffer, 0, inputbuffer.Length);
|
||||||
|
return Convert.ToBase64String(outputBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string Decrypt(this string text) {
|
||||||
|
SymmetricAlgorithm algorithm = DES.Create();
|
||||||
|
ICryptoTransform transform = algorithm.CreateDecryptor(key, iv);
|
||||||
|
byte[] inputbuffer = Convert.FromBase64String(text);
|
||||||
|
byte[] outputBuffer = transform.TransformFinalBlock(inputbuffer, 0, inputbuffer.Length);
|
||||||
|
return Encoding.Unicode.GetString(outputBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GenerateName(int len) {
|
||||||
|
Random random = new Random();
|
||||||
|
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||||
|
return new string(Enumerable.Repeat(chars, len)
|
||||||
|
.Select(s => s[random.Next(s.Length)]).ToArray());
|
||||||
|
}
|
||||||
|
}
|
BIN
icon.ico
BIN
icon.ico
Binary file not shown.
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 58 KiB |
|
@ -0,0 +1,52 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="Costura.Fody" version="5.7.0" targetFramework="net472" developmentDependency="true" />
|
||||||
|
<package id="Fody" version="6.6.4" targetFramework="net472" developmentDependency="true" />
|
||||||
|
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net472" />
|
||||||
|
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="NETStandard.Library" version="1.6.1" targetFramework="net472" />
|
||||||
|
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
|
||||||
|
<package id="System.AppContext" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Collections" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Console" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Diagnostics.DiagnosticSource" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Globalization" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Globalization.Calendars" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.IO" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.IO.Compression" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.IO.Compression.ZipFile" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.IO.FileSystem" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Linq" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Linq.Expressions" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Net.Http" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Net.Primitives" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Net.Sockets" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.ObjectModel" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Reflection" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Runtime" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Runtime.Handles" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Text.Encoding" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Threading" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Threading.Tasks" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Threading.Timer" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net472" />
|
||||||
|
<package id="System.Xml.XDocument" version="4.3.0" targetFramework="net472" />
|
||||||
|
</packages>
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="packages\Costura.Fody.5.7.0\build\Costura.Fody.props" Condition="Exists('packages\Costura.Fody.5.7.0\build\Costura.Fody.props')" />
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
@ -39,27 +40,118 @@
|
||||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="Costura, Version=5.7.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\Costura.Fody.5.7.0\lib\netstandard1.0\Costura.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Win32.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="mscorlib" />
|
||||||
|
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.AppContext, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.AppContext.4.3.0\lib\net463\System.AppContext.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.ComponentModel.Composition" />
|
||||||
|
<Reference Include="System.Console, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Console.4.3.0\lib\net46\System.Console.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Diagnostics.DiagnosticSource.4.3.0\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Diagnostics.Tracing, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Diagnostics.Tracing.4.3.0\lib\net462\System.Diagnostics.Tracing.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Globalization.Calendars, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Globalization.Calendars.4.3.0\lib\net46\System.Globalization.Calendars.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.IO, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.IO.4.3.0\lib\net462\System.IO.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.IO.Compression, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.IO.Compression.FileSystem" />
|
||||||
|
<Reference Include="System.IO.Compression.ZipFile, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.IO.Compression.ZipFile.4.3.0\lib\net46\System.IO.Compression.ZipFile.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.IO.FileSystem, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.IO.FileSystem.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Linq, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Linq.4.3.0\lib\net463\System.Linq.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Linq.Expressions, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Linq.Expressions.4.3.0\lib\net463\System.Linq.Expressions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Net.Http.4.3.0\lib\net46\System.Net.Http.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Net.Sockets, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Net.Sockets.4.3.0\lib\net46\System.Net.Sockets.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Numerics" />
|
||||||
|
<Reference Include="System.Reflection, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Reflection.4.3.0\lib\net462\System.Reflection.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Runtime.Extensions, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Runtime.Extensions.4.3.0\lib\net462\System.Runtime.Extensions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Runtime.InteropServices, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Runtime.InteropServices.4.3.0\lib\net463\System.Runtime.InteropServices.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net463\System.Security.Cryptography.Algorithms.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Text.RegularExpressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Text.RegularExpressions.4.3.0\lib\net463\System.Text.RegularExpressions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Deployment" />
|
<Reference Include="System.Deployment" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Net.Http" />
|
|
||||||
<Reference Include="System.Windows.Forms" />
|
<Reference Include="System.Windows.Forms" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="System.Xml.ReaderWriter, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Config.cs" />
|
||||||
<Compile Include="MainForm.cs">
|
<Compile Include="MainForm.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="MainForm.Designer.cs">
|
<Compile Include="MainForm.Designer.cs">
|
||||||
<DependentUpon>MainForm.cs</DependentUpon>
|
<DependentUpon>MainForm.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Profile.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="RdpFile.cs" />
|
||||||
|
<Compile Include="StringUtil.cs" />
|
||||||
<EmbeddedResource Include="MainForm.resx">
|
<EmbeddedResource Include="MainForm.resx">
|
||||||
<DependentUpon>MainForm.cs</DependentUpon>
|
<DependentUpon>MainForm.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
@ -73,6 +165,7 @@
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<None Include="icon.ico" />
|
<None Include="icon.ico" />
|
||||||
|
<None Include="packages.config" />
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
@ -91,5 +184,15 @@
|
||||||
<Content Include="Resources\banner.png" />
|
<Content Include="Resources\banner.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<Import Project="packages\Fody.6.6.4\build\Fody.targets" Condition="Exists('packages\Fody.6.6.4\build\Fody.targets')" />
|
||||||
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}.</ErrorText>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Error Condition="!Exists('packages\Fody.6.6.4\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Fody.6.6.4\build\Fody.targets'))" />
|
||||||
|
<Error Condition="!Exists('packages\Costura.Fody.5.7.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Costura.Fody.5.7.0\build\Costura.Fody.props'))" />
|
||||||
|
<Error Condition="!Exists('packages\Costura.Fody.5.7.0\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Costura.Fody.5.7.0\build\Costura.Fody.targets'))" />
|
||||||
|
</Target>
|
||||||
|
<Import Project="packages\Costura.Fody.5.7.0\build\Costura.Fody.targets" Condition="Exists('packages\Costura.Fody.5.7.0\build\Costura.Fody.targets')" />
|
||||||
|
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in New Issue