diff --git a/ACTWebSocket.Core/ACTWebSocket.Core.csproj b/ACTWebSocket.Core/ACTWebSocket.Core.csproj index 795b13a..2f59940 100644 --- a/ACTWebSocket.Core/ACTWebSocket.Core.csproj +++ b/ACTWebSocket.Core/ACTWebSocket.Core.csproj @@ -76,10 +76,6 @@ <HintPath>C:\Program Files (x86)\Advanced Combat Tracker\Advanced Combat Tracker.exe</HintPath> <Private>False</Private> </Reference> - <Reference Include="BouncyCastle.Crypto, Version=1.8.1.0, Culture=neutral, PublicKeyToken=0e99375e54769942"> - <HintPath>..\packages\BouncyCastle.1.8.1\lib\BouncyCastle.Crypto.dll</HintPath> - <Private>True</Private> - </Reference> <Reference Include="DotNetZip, Version=1.10.1.0, Culture=neutral, PublicKeyToken=6583c7c814667745, processorArchitecture=MSIL"> <HintPath>..\packages\DotNetZip.1.10.1\lib\net20\DotNetZip.dll</HintPath> <Private>True</Private> diff --git a/ACTWebSocket.Core/ACTWebSocket.cs b/ACTWebSocket.Core/ACTWebSocket.cs index 61e4361..e2fce51 100644 --- a/ACTWebSocket.Core/ACTWebSocket.cs +++ b/ACTWebSocket.Core/ACTWebSocket.cs @@ -56,7 +56,10 @@ public class ACTWebSocketMain : UserControl, IActPluginV1, PluginDirectory private Button buttonOverlay; private ProgressBar progressBar; private Button buttonDownload; - private CheckBox SSLUse; + private GroupBox groupBox4; + private Button buttonCopyCode; + private Label label1; + private TextBox hashCode; private CheckBox chatFilter; public void SetSkinDir(string path) @@ -163,7 +166,10 @@ private void InitializeComponent() this.groupBox3 = new System.Windows.Forms.GroupBox(); this.FileSkinListView = new System.Windows.Forms.ListView(); this.Title = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.SSLUse = new System.Windows.Forms.CheckBox(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.buttonCopyCode = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.hashCode = new System.Windows.Forms.TextBox(); this.startoption.SuspendLayout(); this.hostdata.SuspendLayout(); this.othersets.SuspendLayout(); @@ -171,6 +177,7 @@ private void InitializeComponent() this.groupBox2.SuspendLayout(); this.groupBox1.SuspendLayout(); this.groupBox3.SuspendLayout(); + this.groupBox4.SuspendLayout(); this.SuspendLayout(); // // port @@ -248,7 +255,6 @@ private void InitializeComponent() // startoption // this.startoption.BackColor = System.Drawing.Color.Transparent; - this.startoption.Controls.Add(this.SSLUse); this.startoption.Controls.Add(this.skinOnAct); this.startoption.Controls.Add(this.UPNPUse); this.startoption.Controls.Add(this.randomURL); @@ -472,17 +478,36 @@ private void InitializeComponent() // resources.ApplyResources(this.Title, "Title"); // - // SSLUse + // groupBox4 // - resources.ApplyResources(this.SSLUse, "SSLUse"); - this.SSLUse.BackColor = System.Drawing.Color.Transparent; - this.SSLUse.Name = "SSLUse"; - this.SSLUse.UseVisualStyleBackColor = false; - this.SSLUse.CheckedChanged += new System.EventHandler(this.SSLUse_CheckedChanged); + this.groupBox4.Controls.Add(this.buttonCopyCode); + this.groupBox4.Controls.Add(this.label1); + this.groupBox4.Controls.Add(this.hashCode); + resources.ApplyResources(this.groupBox4, "groupBox4"); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.TabStop = false; + // + // buttonCopyCode + // + resources.ApplyResources(this.buttonCopyCode, "buttonCopyCode"); + this.buttonCopyCode.Name = "buttonCopyCode"; + this.buttonCopyCode.UseVisualStyleBackColor = true; + this.buttonCopyCode.Click += new System.EventHandler(this.buttonCopyCode_Click); + // + // label1 + // + resources.ApplyResources(this.label1, "label1"); + this.label1.Name = "label1"; + // + // hashCode + // + resources.ApplyResources(this.hashCode, "hashCode"); + this.hashCode.Name = "hashCode"; // // ACTWebSocketMain // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.Controls.Add(this.groupBox4); this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); @@ -502,6 +527,8 @@ private void InitializeComponent() this.groupBox2.ResumeLayout(false); this.groupBox1.ResumeLayout(false); this.groupBox3.ResumeLayout(false); + this.groupBox4.ResumeLayout(false); + this.groupBox4.PerformLayout(); this.ResumeLayout(false); } @@ -620,7 +647,7 @@ public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText) BeforeLogLineReadUse.Checked = BeforeLogLineRead; OnLogLineReadUse.Checked = OnLogLineRead; MiniParseUse.Checked = MiniParse; - SSLUse.Checked = UseSSL; + //SSLUse.Checked = UseSSL; UPNPUse.Checked = UseUPnP; randomURL.Checked = RandomURL; skinOnAct.Checked = SkinOnAct; @@ -749,14 +776,14 @@ void LoadSettings() { UseUPnP = false; } - if (obj.TryGetValue("UseSSL", out token)) - { - UseSSL = token.ToObject<bool>(); - } - else - { - UseSSL = false; - } + //if (obj.TryGetValue("UseSSL", out token)) + //{ + // UseSSL = token.ToObject<bool>(); + //} + //else + //{ + // UseSSL = false; + //} if (obj.TryGetValue("SkinOnAct", out token)) { SkinOnAct = token.ToObject<bool>(); @@ -840,7 +867,7 @@ void SaveSettings() obj.Add("Hostname", Hostname); obj.Add("RandomURL", RandomURL); obj.Add("UseUPnP", UseUPnP); - obj.Add("UseSSL", UseSSL); + //obj.Add("UseSSL", UseSSL); obj.Add("AutoRun", AutoRun); obj.Add("AutoOverlay", AutoOverlay); obj.Add("BeforeLogLineRead", BeforeLogLineRead); @@ -971,7 +998,7 @@ public bool RandomURL } } - public bool UseSSL { get; set; } + //public bool UseSSL { get; set; } public bool UseUPnP { get; set; } public bool AutoRun { get; set; } public bool AutoOverlay { get; set; } @@ -1032,11 +1059,11 @@ public void StartServer() { if (UseUPnP) { - core.StartServer(localhostOnly ? "127.0.0.1" : "0.0.0.0", Port, UPnPPort, Hostname, SkinOnAct, UseSSL); + core.StartServer(localhostOnly ? "127.0.0.1" : "0.0.0.0", Port, UPnPPort, Hostname, SkinOnAct, false); } else { - core.StartServer(localhostOnly ? "127.0.0.1" : "0.0.0.0", Port, Port, Hostname, SkinOnAct, UseSSL); + core.StartServer(localhostOnly ? "127.0.0.1" : "0.0.0.0", Port, Port, Hostname, SkinOnAct, false); } } catch (Exception e) @@ -1048,7 +1075,7 @@ public void StartServer() //OnLogLineReadUse.Enabled = false; //MiniParseUse.Enabled = false; //chatFilter.Enabled = false; - SSLUse.Enabled = false; + //SSLUse.Enabled = false; skinOnAct.Enabled = false; UPNPUse.Enabled = false; randomURL.Enabled = false; @@ -1059,26 +1086,88 @@ public void StartServer() buttonOff.Enabled = true; - string serviceType = "_overlay._tcp"; + Task serviceTask = new Task(() => + { + try + { + string serviceType = "_overlay._tcp"; + lock (serviceLock) + { + if (serviceBrowser != null) + { + serviceBrowser.StopBrowse(); + serviceBrowser = null; + } + + { + serviceBrowser = new ServiceBrowser(); + serviceBrowser.ServiceAdded += onServiceAdded; + serviceBrowser.ServiceRemoved += onServiceRemoved; + serviceBrowser.ServiceChanged += onServiceChanged; + + Console.WriteLine("Browsing for type: {0}", serviceType); + serviceBrowser.StartBrowse(serviceType); + Console.ReadLine(); + } + } + + + String url = ("http") + "://" + Hostname + ":" + Port + "/"; + if (ACTWebSocketCore.randomDir != null) + { + url += ACTWebSocketCore.randomDir + "/"; + } + string address = string.Format("http://zcube.kr:8585/shorten?longUrl={0}", Uri.EscapeDataString(url)); + + HttpWebRequest request = HttpWebRequest.CreateHttp(address); + WebResponse response = request.GetResponse(); + String res = ""; + using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8)) + { + res = reader.ReadToEnd(); + } + + res = res; + JObject obj = JObject.Parse(res); + JToken token; + int status_code = 0; + String hash = ""; + if (obj.TryGetValue("status_code", out token)) + { + status_code = token.ToObject<int>(); + } - ServiceBrowser serviceBrowser = new ServiceBrowser(); - serviceBrowser.ServiceAdded += onServiceAdded; - serviceBrowser.ServiceRemoved += onServiceRemoved; - serviceBrowser.ServiceChanged += onServiceChanged; + JObject data = (JObject)obj["data"]; + if (data != null && data.TryGetValue("hash", out token)) + { + hash = token.ToObject<String>(); + } + hashCode.Text = hash; + } + catch (Exception e) + { - Console.WriteLine("Browsing for type: {0}", serviceType); - serviceBrowser.StartBrowse(serviceType); - Console.ReadLine(); + } + }); + serviceTask.Start(); } public void StopServer() { + if (serviceBrowser != null) + { + lock (serviceLock) + { + serviceBrowser.StopBrowse(); + serviceBrowser = null; + } + } core.StopServer(); //BeforeLogLineReadUse.Enabled = true; //OnLogLineReadUse.Enabled = true; //MiniParseUse.Enabled = true; //chatFilter.Enabled = true; - SSLUse.Enabled = true; + //SSLUse.Enabled = true; skinOnAct.Enabled = true; UPNPUse.Enabled = true; randomURL.Enabled = true; @@ -1229,7 +1318,7 @@ public string getURLPath(string skinPath = "", bool withRandomURL = true) { try { - string fullURL = (UseSSL ? "https" : "http") + url + Uri.EscapeDataString(skinPath); + string fullURL = ("http") + url + Uri.EscapeDataString(skinPath); fullURL = fullURL.Replace("%5C", "/"); fullURL = fullURL.Replace("%2F", "/"); return fullURL; @@ -1262,7 +1351,7 @@ private void UpdateFormSettings() BeforeLogLineRead = BeforeLogLineReadUse.Checked; OnLogLineRead = OnLogLineReadUse.Checked; MiniParse = MiniParseUse.Checked; - UseSSL = SSLUse.Checked; + //UseSSL = SSLUse.Checked; UseUPnP = UPNPUse.Checked; RandomURL = randomURL.Checked; SkinOnAct = skinOnAct.Checked; @@ -1313,7 +1402,7 @@ void onServiceAdded(object sender, ServiceAnnouncementEventArgs e) HttpWebRequest webRequest = WebRequest.CreateHttp(uri); webRequest.Headers.Add("Port", Port.ToString()); webRequest.Headers.Add("IP", hostnames.Text.ToString()); - webRequest.Headers.Add("SCHEME", UseSSL ? "https" : "http"); + webRequest.Headers.Add("SCHEME", "http"); webRequest.BeginGetResponse(null, webRequest); } @@ -1472,7 +1561,6 @@ private void AddWebURL(string a) }); Task UITask = task.ContinueWith((t) => { - lock (core.skinObject) { bool find = false; foreach (ListViewItem i in WebSkinListView.Items) @@ -1492,6 +1580,7 @@ private void AddWebURL(string a) WebSkinListView.Items.Add(lvi); if (core != null) { + lock (core.skinObject) { JObject skinInfo = new JObject(); skinInfo["Title"] = title; @@ -1511,6 +1600,9 @@ private void AddWebURL(string a) }, TaskScheduler.FromCurrentSynchronizationContext()); } List<Task> tasklist = new List<Task>(); + private ServiceBrowser serviceBrowser; + private Object serviceLock = new Object(); + private void AddFileURL(string a) { a = a.Replace("\\", "/"); @@ -1521,7 +1613,6 @@ private void AddFileURL(string a) }); Task UITask = task.ContinueWith((t) => { - lock (core.skinObject) { bool find = false; foreach (ListViewItem i in FileSkinListView.Items) @@ -1641,7 +1732,7 @@ private void UPNPUse_CheckedChanged(object sender, EventArgs e) private void UseSSL_CheckedChanged(object sender, EventArgs e) { - UseSSL = SSLUse.Checked; + //UseSSL = SSLUse.Checked; } private void skinOnAct_CheckedChanged(object sender, EventArgs e) @@ -1650,6 +1741,24 @@ private void skinOnAct_CheckedChanged(object sender, EventArgs e) buttonRefresh_Click(sender, e); } + private void buttonCopyCode_Click(object sender, EventArgs e) + { + String id = hashCode.Text; + Task task = Task.Factory.StartNew(() => + { + string url = ("http") + getURLPath(""); + string address = string.Format("https://dev.zcube.kr/fcmhelper/v1/message?id={0}&message={1}", Uri.EscapeDataString(id), Uri.EscapeDataString(url)); + + HttpWebRequest request = HttpWebRequest.CreateHttp(address); + WebResponse response = request.GetResponse(); + String res = ""; + using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8)) + { + res = reader.ReadToEnd(); + } + }); + } + void UpdateOverlayProc() { bool b = File.Exists(overlayProcExe); @@ -1961,7 +2070,8 @@ private void ServerUrlChanged() private void SSLUse_CheckedChanged(object sender, EventArgs e) { - + //UseSSL = SSLUse.Checked; } + } } diff --git a/ACTWebSocket.Core/ACTWebSocket.resx b/ACTWebSocket.Core/ACTWebSocket.resx index 4ee1799..7a97f2a 100644 --- a/ACTWebSocket.Core/ACTWebSocket.resx +++ b/ACTWebSocket.Core/ACTWebSocket.resx @@ -175,7 +175,7 @@ <value>startoption</value> </data> <data name=">>autostart.ZOrder" xml:space="preserve"> - <value>4</value> + <value>3</value> </data> <data name="MiniParseUse.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> <value>Top, Bottom, Left, Right</value> @@ -361,7 +361,7 @@ <value>startoption</value> </data> <data name=">>UPNPUse.ZOrder" xml:space="preserve"> - <value>2</value> + <value>1</value> </data> <data name="randomURL.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> <value>Top, Left, Right</value> @@ -391,37 +391,7 @@ <value>startoption</value> </data> <data name=">>randomURL.ZOrder" xml:space="preserve"> - <value>3</value> - </data> - <data name="SSLUse.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> - <value>Top, Left, Right</value> - </data> - <data name="SSLUse.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms"> - <value>NoControl</value> - </data> - <data name="SSLUse.Location" type="System.Drawing.Point, System.Drawing"> - <value>11, 116</value> - </data> - <data name="SSLUse.Size" type="System.Drawing.Size, System.Drawing"> - <value>231, 21</value> - </data> - <data name="SSLUse.TabIndex" type="System.Int32, mscorlib"> - <value>15</value> - </data> - <data name="SSLUse.Text" xml:space="preserve"> - <value>Use SSL (Self-Signed)</value> - </data> - <data name=">>SSLUse.Name" xml:space="preserve"> - <value>SSLUse</value> - </data> - <data name=">>SSLUse.Type" xml:space="preserve"> - <value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> - </data> - <data name=">>SSLUse.Parent" xml:space="preserve"> - <value>startoption</value> - </data> - <data name=">>SSLUse.ZOrder" xml:space="preserve"> - <value>0</value> + <value>2</value> </data> <data name="skinOnAct.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> <value>Top, Left, Right</value> @@ -451,13 +421,13 @@ <value>startoption</value> </data> <data name=">>skinOnAct.ZOrder" xml:space="preserve"> - <value>1</value> + <value>0</value> </data> <data name="startoption.Location" type="System.Drawing.Point, System.Drawing"> <value>3, 3</value> </data> <data name="startoption.Size" type="System.Drawing.Size, System.Drawing"> - <value>249, 151</value> + <value>249, 126</value> </data> <data name="startoption.TabIndex" type="System.Int32, mscorlib"> <value>15</value> @@ -475,7 +445,7 @@ <value>$this</value> </data> <data name=">>startoption.ZOrder" xml:space="preserve"> - <value>6</value> + <value>7</value> </data> <data name="hostnames.Location" type="System.Drawing.Point, System.Drawing"> <value>79, 23</value> @@ -610,7 +580,7 @@ <value>4</value> </data> <data name="hostdata.Location" type="System.Drawing.Point, System.Drawing"> - <value>2, 160</value> + <value>3, 135</value> </data> <data name="hostdata.Size" type="System.Drawing.Size, System.Drawing"> <value>249, 109</value> @@ -631,7 +601,7 @@ <value>$this</value> </data> <data name=">>hostdata.ZOrder" xml:space="preserve"> - <value>5</value> + <value>6</value> </data> <data name="chatFilter.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> <value>Top, Bottom, Left, Right</value> @@ -667,7 +637,7 @@ <value>0</value> </data> <data name="othersets.Location" type="System.Drawing.Point, System.Drawing"> - <value>3, 275</value> + <value>3, 253</value> </data> <data name="othersets.Size" type="System.Drawing.Size, System.Drawing"> <value>248, 125</value> @@ -688,10 +658,10 @@ <value>$this</value> </data> <data name=">>othersets.ZOrder" xml:space="preserve"> - <value>4</value> + <value>5</value> </data> <data name="serverStatus.Location" type="System.Drawing.Point, System.Drawing"> - <value>3, 406</value> + <value>4, 384</value> </data> <data name="serverStatus.Size" type="System.Drawing.Size, System.Drawing"> <value>248, 79</value> @@ -712,7 +682,7 @@ <value>$this</value> </data> <data name=">>serverStatus.ZOrder" xml:space="preserve"> - <value>3</value> + <value>4</value> </data> <data name="copyURL.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> <value>Bottom, Left</value> @@ -721,7 +691,7 @@ <value>NoControl</value> </data> <data name="copyURL.Location" type="System.Drawing.Point, System.Drawing"> - <value>162, 173</value> + <value>162, 144</value> </data> <data name="copyURL.Size" type="System.Drawing.Size, System.Drawing"> <value>75, 26</value> @@ -751,7 +721,7 @@ <value>NoControl</value> </data> <data name="buttonAddURL.Location" type="System.Drawing.Point, System.Drawing"> - <value>6, 173</value> + <value>6, 144</value> </data> <data name="buttonAddURL.Size" type="System.Drawing.Size, System.Drawing"> <value>75, 26</value> @@ -781,7 +751,7 @@ <value>NoControl</value> </data> <data name="buttonURL.Location" type="System.Drawing.Point, System.Drawing"> - <value>84, 173</value> + <value>84, 144</value> </data> <data name="buttonURL.Size" type="System.Drawing.Size, System.Drawing"> <value>75, 26</value> @@ -817,7 +787,7 @@ <value>4, 20</value> </data> <data name="WebSkinListView.Size" type="System.Drawing.Size, System.Drawing"> - <value>388, 147</value> + <value>388, 118</value> </data> <data name="WebSkinListView.TabIndex" type="System.Int32, mscorlib"> <value>23</value> @@ -841,7 +811,7 @@ <value>NoControl</value> </data> <data name="buttonOpen.Location" type="System.Drawing.Point, System.Drawing"> - <value>240, 173</value> + <value>240, 144</value> </data> <data name="buttonOpen.Size" type="System.Drawing.Size, System.Drawing"> <value>75, 26</value> @@ -871,7 +841,7 @@ <value>NoControl</value> </data> <data name="buttonOverlay.Location" type="System.Drawing.Point, System.Drawing"> - <value>318, 173</value> + <value>318, 144</value> </data> <data name="buttonOverlay.Size" type="System.Drawing.Size, System.Drawing"> <value>75, 26</value> @@ -895,10 +865,10 @@ <value>0</value> </data> <data name="groupBox2.Location" type="System.Drawing.Point, System.Drawing"> - <value>258, 275</value> + <value>258, 223</value> </data> <data name="groupBox2.Size" type="System.Drawing.Size, System.Drawing"> - <value>404, 210</value> + <value>404, 181</value> </data> <data name="groupBox2.TabIndex" type="System.Int32, mscorlib"> <value>31</value> @@ -916,7 +886,7 @@ <value>$this</value> </data> <data name=">>groupBox2.ZOrder" xml:space="preserve"> - <value>1</value> + <value>2</value> </data> <data name="autostartoverlay.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> <value>Top, Left, Right</value> @@ -1069,7 +1039,7 @@ <value>$this</value> </data> <data name=">>groupBox1.ZOrder" xml:space="preserve"> - <value>2</value> + <value>3</value> </data> <data name="FileSkinListView.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> <value>Top, Bottom, Left</value> @@ -1084,7 +1054,7 @@ <value>4, 20</value> </data> <data name="FileSkinListView.Size" type="System.Drawing.Size, System.Drawing"> - <value>388, 147</value> + <value>388, 94</value> </data> <data name="FileSkinListView.TabIndex" type="System.Int32, mscorlib"> <value>23</value> @@ -1102,10 +1072,10 @@ <value>0</value> </data> <data name="groupBox3.Location" type="System.Drawing.Point, System.Drawing"> - <value>258, 90</value> + <value>257, 91</value> </data> <data name="groupBox3.Size" type="System.Drawing.Size, System.Drawing"> - <value>404, 179</value> + <value>404, 126</value> </data> <data name="groupBox3.TabIndex" type="System.Int32, mscorlib"> <value>32</value> @@ -1123,6 +1093,108 @@ <value>$this</value> </data> <data name=">>groupBox3.ZOrder" xml:space="preserve"> + <value>1</value> + </data> + <data name="buttonCopyCode.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> + <value>Bottom, Left</value> + </data> + <data name="buttonCopyCode.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms"> + <value>NoControl</value> + </data> + <data name="buttonCopyCode.Location" type="System.Drawing.Point, System.Drawing"> + <value>301, 13</value> + </data> + <data name="buttonCopyCode.Size" type="System.Drawing.Size, System.Drawing"> + <value>96, 26</value> + </data> + <data name="buttonCopyCode.TabIndex" type="System.Int32, mscorlib"> + <value>26</value> + </data> + <data name="buttonCopyCode.Text" xml:space="preserve"> + <value>Push URL</value> + </data> + <data name=">>buttonCopyCode.Name" xml:space="preserve"> + <value>buttonCopyCode</value> + </data> + <data name=">>buttonCopyCode.Type" xml:space="preserve"> + <value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </data> + <data name=">>buttonCopyCode.Parent" xml:space="preserve"> + <value>groupBox4</value> + </data> + <data name=">>buttonCopyCode.ZOrder" xml:space="preserve"> + <value>0</value> + </data> + <data name="label1.AutoSize" type="System.Boolean, mscorlib"> + <value>True</value> + </data> + <data name="label1.Location" type="System.Drawing.Point, System.Drawing"> + <value>7, 21</value> + </data> + <data name="label1.Size" type="System.Drawing.Size, System.Drawing"> + <value>16, 12</value> + </data> + <data name="label1.TabIndex" type="System.Int32, mscorlib"> + <value>1</value> + </data> + <data name="label1.Text" xml:space="preserve"> + <value>ID</value> + </data> + <data name=">>label1.Name" xml:space="preserve"> + <value>label1</value> + </data> + <data name=">>label1.Type" xml:space="preserve"> + <value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </data> + <data name=">>label1.Parent" xml:space="preserve"> + <value>groupBox4</value> + </data> + <data name=">>label1.ZOrder" xml:space="preserve"> + <value>1</value> + </data> + <data name="hashCode.Location" type="System.Drawing.Point, System.Drawing"> + <value>59, 18</value> + </data> + <data name="hashCode.Size" type="System.Drawing.Size, System.Drawing"> + <value>236, 21</value> + </data> + <data name="hashCode.TabIndex" type="System.Int32, mscorlib"> + <value>0</value> + </data> + <data name=">>hashCode.Name" xml:space="preserve"> + <value>hashCode</value> + </data> + <data name=">>hashCode.Type" xml:space="preserve"> + <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </data> + <data name=">>hashCode.Parent" xml:space="preserve"> + <value>groupBox4</value> + </data> + <data name=">>hashCode.ZOrder" xml:space="preserve"> + <value>2</value> + </data> + <data name="groupBox4.Location" type="System.Drawing.Point, System.Drawing"> + <value>257, 410</value> + </data> + <data name="groupBox4.Size" type="System.Drawing.Size, System.Drawing"> + <value>404, 53</value> + </data> + <data name="groupBox4.TabIndex" type="System.Int32, mscorlib"> + <value>20</value> + </data> + <data name="groupBox4.Text" xml:space="preserve"> + <value>MobileProc ID</value> + </data> + <data name=">>groupBox4.Name" xml:space="preserve"> + <value>groupBox4</value> + </data> + <data name=">>groupBox4.Type" xml:space="preserve"> + <value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </data> + <data name=">>groupBox4.Parent" xml:space="preserve"> + <value>$this</value> + </data> + <data name=">>groupBox4.ZOrder" xml:space="preserve"> <value>0</value> </data> <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> diff --git a/ACTWebSocket.Core/ACTWebSocketCore.cs b/ACTWebSocket.Core/ACTWebSocketCore.cs index ad9edc0..04a4493 100644 --- a/ACTWebSocket.Core/ACTWebSocketCore.cs +++ b/ACTWebSocket.Core/ACTWebSocketCore.cs @@ -1,13 +1,5 @@ using Advanced_Combat_Tracker; using Newtonsoft.Json.Linq; -using Org.BouncyCastle.Asn1.X509; -using Org.BouncyCastle.Crypto; -using Org.BouncyCastle.Crypto.Generators; -using Org.BouncyCastle.Crypto.Parameters; -using Org.BouncyCastle.Crypto.Prng; -using Org.BouncyCastle.Math; -using Org.BouncyCastle.Security; -using Org.BouncyCastle.X509; using System; using System.Collections.Generic; using System.Linq; @@ -52,42 +44,42 @@ void InitUpdate() Broadcast("/MiniParse", SendMessageType.CombatData.ToString(), overlayAPI.CreateEncounterJsonData()); } - static X509Certificate2 GenerateCertificate(string certName) - { - var keypairgen = new RsaKeyPairGenerator(); - keypairgen.Init(new KeyGenerationParameters(new SecureRandom(new CryptoApiRandomGenerator()), 2048)); + //static X509Certificate2 GenerateCertificate(string certName) + //{ + // var keypairgen = new RsaKeyPairGenerator(); + // keypairgen.Init(new KeyGenerationParameters(new SecureRandom(new CryptoApiRandomGenerator()), 2048)); - var keypair = keypairgen.GenerateKeyPair(); + // var keypair = keypairgen.GenerateKeyPair(); - var gen = new X509V3CertificateGenerator(); + // var gen = new X509V3CertificateGenerator(); - var CN = new X509Name("CN=" + certName); - var SN = BigInteger.ProbablePrime(120, new Random()); + // var CN = new X509Name("CN=" + certName); + // var SN = BigInteger.ProbablePrime(120, new Random()); - gen.SetSerialNumber(SN); - gen.SetSubjectDN(CN); - gen.SetIssuerDN(CN); - gen.SetNotAfter(DateTime.MaxValue); - gen.SetNotBefore(DateTime.Now.Subtract(new TimeSpan(7, 0, 0, 0))); - gen.SetSignatureAlgorithm("SHA256WithRSA"); - gen.SetPublicKey(keypair.Public); + // gen.SetSerialNumber(SN); + // gen.SetSubjectDN(CN); + // gen.SetIssuerDN(CN); + // gen.SetNotAfter(DateTime.MaxValue); + // gen.SetNotBefore(DateTime.Now.Subtract(new TimeSpan(7, 0, 0, 0))); + // gen.SetSignatureAlgorithm("SHA256WithRSA"); + // gen.SetPublicKey(keypair.Public); - var newCert = gen.Generate(keypair.Private); + // var newCert = gen.Generate(keypair.Private); - X509Certificate2 cert = new X509Certificate2(DotNetUtilities.ToX509Certificate((Org.BouncyCastle.X509.X509Certificate)newCert)); - cert.PrivateKey = DotNetUtilities.ToRSA((RsaPrivateCrtKeyParameters) keypair.Private); - return cert; - } + // X509Certificate2 cert = new X509Certificate2(DotNetUtilities.ToX509Certificate((Org.BouncyCastle.X509.X509Certificate)newCert)); + // cert.PrivateKey = DotNetUtilities.ToRSA((RsaPrivateCrtKeyParameters) keypair.Private); + // return cert; + //} internal void StartServer(string address, int port, int extPort, string domain = null, bool skinOnAct = false, bool useSSL = false) { StopServer(); httpServer = new HttpServer(System.Net.IPAddress.Parse(address), port, useSSL); httpServer.ReuseAddress = true; - if (useSSL) - { - httpServer.SslConfiguration.ServerCertificate = GenerateCertificate(domain); - } + //if (useSSL) + //{ + // httpServer.SslConfiguration.ServerCertificate = GenerateCertificate(domain); + //} // TODO : SSL //wssv = new WebSocketServer(System.Net.IPAddress.Parse(address), port, true); diff --git a/Dist/build.bat b/Dist/build.bat index 0e90807..021d95a 100644 --- a/Dist/build.bat +++ b/Dist/build.bat @@ -23,8 +23,6 @@ xcopy /hrkysd ACTWebSocket.Loader\bin\Release\DotNetZip*.dll Dist\temp if %errorlevel% neq 0 exit /b %errorlevel% xcopy /hrkysd ACTWebSocket.Loader\bin\Release\Tmds*.dll Dist\temp if %errorlevel% neq 0 exit /b %errorlevel% -xcopy /hrkysd ACTWebSocket.Loader\bin\Release\BouncyCastle*.dll Dist\temp -if %errorlevel% neq 0 exit /b %errorlevel% popd