diff --git a/ACTWebSocket.Core/ACTWebSocket.Core.csproj b/ACTWebSocket.Core/ACTWebSocket.Core.csproj index adcd753..145127d 100644 --- a/ACTWebSocket.Core/ACTWebSocket.Core.csproj +++ b/ACTWebSocket.Core/ACTWebSocket.Core.csproj @@ -151,6 +151,7 @@ + diff --git a/ACTWebSocket.Core/ACTWebSocket.cs b/ACTWebSocket.Core/ACTWebSocket.cs index 9cdbbbf..7eda5df 100644 --- a/ACTWebSocket.Core/ACTWebSocket.cs +++ b/ACTWebSocket.Core/ACTWebSocket.cs @@ -102,11 +102,22 @@ public class ACTWebSocketMain : UserControl, IActPluginV1, PluginDirectory private TextBox currentOverlayVersion; private Button buttonOverlayGitHub; private TextBox releaseOverlayVersion; + private Button buttonUninstall; private CheckBox chatFilter; public void SetSkinDir(string path) { overlaySkinDirectory = path; + if(!Directory.Exists(overlaySkinDirectory)) + { + try + { + Directory.CreateDirectory(overlaySkinDirectory); + } + catch(Exception e) + { +} + } } public void SetScreenShotDir(string path) @@ -259,6 +270,7 @@ private void InitializeComponent() this.textBox1 = new System.Windows.Forms.TextBox(); this.buttonDXInstall = new System.Windows.Forms.Button(); this.dx_progress = new System.Windows.Forms.ProgressBar(); + this.buttonUninstall = new System.Windows.Forms.Button(); this.startoption.SuspendLayout(); this.hostdata.SuspendLayout(); this.othersets.SuspendLayout(); @@ -731,7 +743,6 @@ private void InitializeComponent() // // tabPage2 // - this.tabPage2.Controls.Add(this.groupBox7); this.tabPage2.Controls.Add(this.groupBox6); resources.ApplyResources(this.tabPage2, "tabPage2"); this.tabPage2.Name = "tabPage2"; @@ -800,6 +811,8 @@ private void InitializeComponent() // // groupBox6 // + this.groupBox6.Controls.Add(this.groupBox7); + this.groupBox6.Controls.Add(this.buttonUninstall); this.groupBox6.Controls.Add(this.buttonFindDirectory); this.groupBox6.Controls.Add(this.gamepath); this.groupBox6.Controls.Add(this.label5); @@ -873,6 +886,13 @@ private void InitializeComponent() resources.ApplyResources(this.dx_progress, "dx_progress"); this.dx_progress.Name = "dx_progress"; // + // buttonUninstall + // + resources.ApplyResources(this.buttonUninstall, "buttonUninstall"); + this.buttonUninstall.Name = "buttonUninstall"; + this.buttonUninstall.UseVisualStyleBackColor = true; + this.buttonUninstall.Click += new System.EventHandler(this.buttonUninstall_Click); + // // ACTWebSocketMain // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -1035,12 +1055,14 @@ public static bool SendMessage(JObject obj) { if (ipc == null) return false; - return ipc.SendMessage(0, obj.ToString()); + return ipc.SendMessage(0, obj.ToString(Newtonsoft.Json.Formatting.None)); } public static IPC_Base ipc = null; public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText) { + SynchronizationContext.SetSynchronizationContext(new SynchronizationContext()); + UpdateOverlayProc(); if (core == null) { @@ -1078,46 +1100,56 @@ public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText) core.Config.SortType = MiniParseSortType.NumericDescending; } - try + Exception ex = null; + Task task = Task.Factory.StartNew(() => { - if (autostart.Checked) + try { - StartServer(); + if (autostart.Checked) + { + StartServer(); + } + else + { + StopServer(); + } } - else + catch (Exception e) { + ex = e; StopServer(); } - } - catch (Exception e) - { - MessageBox.Show(e.Message); - StopServer(); - } - try - { - if (autostartoverlay.Checked) + try { - StartOverlayProc(); + if (autostartoverlay.Checked) + { + StartOverlayProc(); + } + } + catch (Exception e) + { + ex = e; + StopServer(); } - } - catch (Exception e) - { - MessageBox.Show(e.Message); - StopServer(); - } + if(ex != null) + MessageBox.Show(ex.Message); + }); // Create some sort of parsing event handler. After the "+=" hit TAB twice and the code will be generated for you. ActGlobals.oFormActMain.BeforeLogLineRead += oFormActMain_BeforeLogLineRead; ActGlobals.oFormActMain.OnLogLineRead += oFormActMain_OnLogLineRead; var s = ActGlobals.oFormActMain.ActPlugins; lblStatus.Text = "Plugin Started"; + + Version version = AssemblyName.GetAssemblyName(pluginPath).Version; + ACTWebSocketCore.currentVersionString = version.Major.ToString() + "." + version.Minor.ToString() + "." + version.Build.ToString() + "." + version.Revision.ToString(); + } public void DeInitPlugin() { - //StopServer(); + StopServer(); // Unsubscribe from any events you listen to when exiting! ActGlobals.oFormActMain.BeforeLogLineRead -= oFormActMain_BeforeLogLineRead; ActGlobals.oFormActMain.OnLogLineRead -= oFormActMain_OnLogLineRead; @@ -1386,15 +1418,13 @@ private void ACTWebSocket_Load(object sender, EventArgs e) addrs = Utility.Distinct(addrs); addrs.Sort(); core.SetAddress(addrs); - }); - Task UITask = task.ContinueWith((t) => - { + hostnames.Items.Clear(); foreach (var addr in addrs) { hostnames.Items.Add(addr); } - }, TaskScheduler.FromCurrentSynchronizationContext()); + }); VersionCheck(); OverlayVersionCheck(gamepath.Text); CheckUpdate(); @@ -1439,7 +1469,7 @@ void VersionCheck() } catch (Exception ex) { - + currentVersion.Text = currentVersionString = ""; } Task task2 = Task.Factory.StartNew(() => @@ -1452,9 +1482,6 @@ void VersionCheck() { } - }); - Task UITask2 = task2.ContinueWith((t) => - { //develVersion.Text = latestTag + "." + develVersion; try { @@ -1465,7 +1492,7 @@ void VersionCheck() { } - }, TaskScheduler.FromCurrentSynchronizationContext()); + }); Task task3 = Task.Factory.StartNew(() => { @@ -1477,9 +1504,6 @@ void VersionCheck() { } - }); - Task UITask3 = task3.ContinueWith((t) => - { //develVersion.Text = latestTag + "." + develVersion; try { @@ -1490,7 +1514,7 @@ void VersionCheck() { } - }, TaskScheduler.FromCurrentSynchronizationContext()); + }); } private bool IsChattings(LogLineEventArgs e) @@ -1927,7 +1951,10 @@ private void UpdateFormSettings() private void buttonOn_Click(object sender, EventArgs e) { UpdateFormSettings(); - StartServer(); + Task task = Task.Factory.StartNew(() => + { + StartServer(); + }); } void onServiceChanged(object sender, ServiceAnnouncementEventArgs e) @@ -1961,7 +1988,10 @@ void printService(char startChar, ServiceAnnouncement service) private void buttonOff_Click(object sender, EventArgs e) { - StopServer(); + Task task = Task.Factory.StartNew(() => + { + StopServer(); + }); } private void port_KeyPress(object sender, KeyPressEventArgs e) @@ -2005,41 +2035,47 @@ private void buttonAddURL_Click(object sender, EventArgs e) { string url = ShowDialog("Add URL", "Add URL").Trim() ; SkinURLList.Add(url); - AddWebURL(url); + Task task = Task.Factory.StartNew(() => + { + AddWebURL(url); + }); } private void buttonURL_Click(object sender, EventArgs e) { - if (WebSkinListView.SelectedItems == null) return; - if(WebSkinListView.SelectedItems.Count > 0) + lock (WebSkinListView) { - string url = (string)WebSkinListView.SelectedItems[0].Tag; - SkinURLList.Remove(url); - WebSkinListView.Items.RemoveAt(WebSkinListView.SelectedItems[0].Index); + if (WebSkinListView.SelectedItems == null) return; + if (WebSkinListView.SelectedItems.Count > 0) { - if (core != null) + string url = (string)WebSkinListView.SelectedItems[0].Tag; + SkinURLList.Remove(url); + WebSkinListView.Items.RemoveAt(WebSkinListView.SelectedItems[0].Index); { - lock (core.skinObject) + if (core != null) { - JArray urlConverted = new JArray(); - JArray array = (JArray)core.skinObject["URLList"].DeepClone(); - if (array != null) + lock (core.skinObject) { - foreach (JToken obj in array) + JArray urlConverted = new JArray(); + JArray array = (JArray)core.skinObject["URLList"].DeepClone(); + if (array != null) { - if (obj["URL"].ToObject() == url) + foreach (JToken obj in array) { - obj.Remove(); - break; + if (obj["URL"].ToObject() == url) + { + obj.Remove(); + break; + } } } + core.skinObject["URLList"] = array; + SendMessage(JObject.FromObject(new + { + cmd = "urllist", + value = core.skinObject + })); } - core.skinObject["URLList"] = array; - SendMessage(JObject.FromObject(new - { - cmd = "urllist", - value = core.skinObject - })); } } } @@ -2048,20 +2084,26 @@ private void buttonURL_Click(object sender, EventArgs e) private void copyURL_Click(object sender, EventArgs e) { - if (WebSkinListView.SelectedItems == null) return; - if (WebSkinListView.SelectedItems.Count > 0) + lock (FileSkinListView) { - string url = (string)WebSkinListView.SelectedItems[0].Tag; - copyURLPath(url); - } - else if (FileSkinListView.SelectedItems.Count > 0) - { - string url = (string)FileSkinListView.SelectedItems[0].Tag; - copyURLPath(url); - } - else - { - copyURLPath(); + lock (WebSkinListView) + { + if (WebSkinListView.SelectedItems == null) return; + if (WebSkinListView.SelectedItems.Count > 0) + { + string url = (string)WebSkinListView.SelectedItems[0].Tag; + copyURLPath(url); + } + else if (FileSkinListView.SelectedItems.Count > 0) + { + string url = (string)FileSkinListView.SelectedItems[0].Tag; + copyURLPath(url); + } + else + { + copyURLPath(); + } + } } } @@ -2084,6 +2126,7 @@ string GetTitle(string path) else { WebClient wc = new WebClient(); + wc.Headers["User-Agent"] = "ACTWebSocket ("+currentVersionString+")"; wc.Encoding = Encoding.UTF8; string source = wc.DownloadString(path); title = Regex.Match(source, @"\]*\>\s*(?[\s\S]*?)\</title\>", RegexOptions.IgnoreCase).Groups["Title"].Value; @@ -2099,20 +2142,20 @@ string GetTitle(string path) private void AddWebURL(string a) { - string title = null; - Task task = Task.Factory.StartNew(() => + try { + string title = null; title = GetTitle(a); - }); - Task UITask = task.ContinueWith((t) => - { { bool find = false; - foreach (ListViewItem i in WebSkinListView.Items) + lock(WebSkinListView) { - if (((string)i.Tag).CompareTo(a) == 0) + foreach (ListViewItem i in WebSkinListView.Items) { - find = true; + if (((string)i.Tag).CompareTo(a) == 0) + { + find = true; + } } } @@ -2122,7 +2165,10 @@ private void AddWebURL(string a) ListViewItem lvi = new ListViewItem(); lvi.Text = title; lvi.Tag = a; - WebSkinListView.Items.Add(lvi); + lock (WebSkinListView) + { + WebSkinListView.Items.Add(lvi); + } if (core != null) { lock (core.skinObject) @@ -2142,7 +2188,11 @@ private void AddWebURL(string a) } } } - }, TaskScheduler.FromCurrentSynchronizationContext()); + } + catch(Exception e) + { + MessageBox.Show(e.Message); + } } List<Task> tasklist = new List<Task>(); private ServiceBrowser serviceBrowser; @@ -2152,14 +2202,11 @@ private void AddFileURL(string a) { a = a.Replace("\\", "/"); string title = null; - Task task = Task.Factory.StartNew(() => - { - title = GetTitle(a); - }); - Task UITask = task.ContinueWith((t) => + title = GetTitle(a); { + bool find = false; + lock (FileSkinListView) { - bool find = false; foreach (ListViewItem i in FileSkinListView.Items) { if (((string)i.Tag).CompareTo(a) == 0) @@ -2168,85 +2215,91 @@ private void AddFileURL(string a) break; } } + } - if (!find) + if (!find) + { + title = (title == null || title == "") ? a : title; + ListViewItem lvi = new ListViewItem(); + lvi.Text = title; + lvi.Tag = a; + lock (FileSkinListView) { - title = (title == null || title == "") ? a : title; - ListViewItem lvi = new ListViewItem(); - lvi.Text = title; - lvi.Tag = a; FileSkinListView.Items.Add(lvi); - if (core != null) + } + if (core != null) + { + lock (core.skinObject) { - lock (core.skinObject) + JObject skinInfo = new JObject(); + skinInfo["Title"] = title; + skinInfo["URL"] = a; + JArray array = (JArray)core.skinObject["URLList"]; + if (array == null) { - JObject skinInfo = new JObject(); - skinInfo["Title"] = title; - skinInfo["URL"] = a; - JArray array = (JArray)core.skinObject["URLList"]; - if (array == null) - { - array = new JArray(); - core.skinObject["URLList"] = array; - } - array.Add(skinInfo); - ServerUrlChanged(); + array = new JArray(); + core.skinObject["URLList"] = array; } + array.Add(skinInfo); + ServerUrlChanged(); } } } - }, TaskScheduler.FromCurrentSynchronizationContext()); - Task finalTask = UITask.ContinueWith((t) => - { - tasklist.Remove(UITask); - tasklist.Remove(task); - }, TaskScheduler.FromCurrentSynchronizationContext()); - lock(tasklist) - { - tasklist.Add(task); - tasklist.Add(UITask); } } private void buttonRefresh_Click(object sender, EventArgs e) { - lock (tasklist) + try { - foreach(var task in tasklist) + Task task = Task.Factory.StartNew(() => { - task.Wait(); - } - tasklist.Clear(); - } - - lock (core.skinObject) - { - JArray array = (JArray)core.skinObject["URLList"]; - array = new JArray(); - core.skinObject["URLList"] = array; - } - FileSkinListView.Items.Clear(); - WebSkinListView.Items.Clear(); - foreach (var a in SkinURLList) - { - AddWebURL(a); - } + skinOnAct.Enabled = false; + int s = 0; + lock (core.skinObject) + { + JArray array = (JArray)core.skinObject["URLList"]; + array = new JArray(); + core.skinObject["URLList"] = array; + } + lock (FileSkinListView) + { + FileSkinListView.Items.Clear(); + } + lock (WebSkinListView) + { + WebSkinListView.Items.Clear(); + } + foreach (var a in SkinURLList) + { + AddWebURL(a); + } - List<string> list = GetFileSkinList(); - foreach(var a in list) - { - bool find = false; - for(int i=0;i< FileSkinListView.Items.Count;++i) - { - if(FileSkinListView.Items[i].Tag == a) + List<string> list = GetFileSkinList(); + foreach (var a in list) { - find = true; + bool find = false; + lock (FileSkinListView) + { + for (int i = 0; i < FileSkinListView.Items.Count; ++i) + { + if (FileSkinListView.Items[i].Tag == a) + { + find = true; + } + } + } + if (!find) + { + AddFileURL(a); + } } - } - if(!find) - { - AddFileURL(a); - } + skinOnAct.Enabled = buttonOn.Enabled; + }); + } + catch (Exception ex) + { + Console.Out.Write(ex.Message); } } @@ -2326,28 +2379,34 @@ void UpdateOverlayProc() } private void buttonOpen_Click(object sender, EventArgs e) { - if (WebSkinListView.SelectedItems.Count > 0) - { - string url = (string)WebSkinListView.SelectedItems[0].Tag; - url = getURLPath(url); - if(url != null) - { - System.Diagnostics.Process.Start(url); - } - } - else if (FileSkinListView.SelectedItems.Count > 0) + lock(FileSkinListView) { - string url = (string)FileSkinListView.SelectedItems[0].Tag; - url = getURLPath(url); - if (url != null) + lock(WebSkinListView) { - System.Diagnostics.Process.Start(url); + if (WebSkinListView.SelectedItems.Count > 0) + { + string url = (string)WebSkinListView.SelectedItems[0].Tag; + url = getURLPath(url); + if (url != null) + { + System.Diagnostics.Process.Start(url); + } + } + else if (FileSkinListView.SelectedItems.Count > 0) + { + string url = (string)FileSkinListView.SelectedItems[0].Tag; + url = getURLPath(url); + if (url != null) + { + System.Diagnostics.Process.Start(url); + } + } + else + { + copyURLPath(); + } } } - else - { - copyURLPath(); - } } private void port_TextChanged(object sender, EventArgs e) @@ -2357,17 +2416,29 @@ private void port_TextChanged(object sender, EventArgs e) private void skinList_SelectedIndexChanged(object sender, EventArgs e) { - if (WebSkinListView.SelectedItems.Count > 0) + lock (FileSkinListView) { - FileSkinListView.SelectedItems.Clear(); + lock (WebSkinListView) + { + if (WebSkinListView.SelectedItems.Count > 0) + { + FileSkinListView.SelectedItems.Clear(); + } + } } } private void FileSkinListView_SelectedIndexChanged(object sender, EventArgs e) { - if (FileSkinListView.SelectedItems.Count > 0) + lock (FileSkinListView) { - WebSkinListView.SelectedItems.Clear(); + lock (WebSkinListView) + { + if (FileSkinListView.SelectedItems.Count > 0) + { + WebSkinListView.SelectedItems.Clear(); + } + } } } @@ -2468,6 +2539,8 @@ public void CheckUpdate() try { WebClient webClient = new WebClient(); + webClient.Headers["User-Agent"] = "ACTWebSocket (" + currentVersionString + ")"; + string extractDir = pluginDirectory + "/overlay_proc"; string revisionFile = extractDir + "/.revision"; string baseurl = "https://static.zcube.kr/publish/OverlayProc/"+comboBoxOverlayProcType.Text.Trim()+"/"; @@ -2536,10 +2609,7 @@ public void CheckUpdate() catch (Exception ex) { } - }); - Task UITask = task.ContinueWith((t) => - { - if(updateNeeded) + if (updateNeeded) { updateLabel.Text = "New : " + version; } @@ -2547,8 +2617,7 @@ public void CheckUpdate() { updateLabel.Text = ""; } - }, TaskScheduler.FromCurrentSynchronizationContext()); - + }); } @@ -2571,6 +2640,8 @@ private void buttonDownload_Click(object sender, EventArgs e) string savefile = pluginDirectory + "/overlay_proc.zip"; WebClient webClient = new WebClient(); + webClient.Headers["User-Agent"] = "ACTWebSocket (" + currentVersionString + ")"; + progressBar.Value = 0; progressBar.Minimum = 0; progressBar.Maximum = 100; @@ -2686,16 +2757,13 @@ private void buttonDownload_Click(object sender, EventArgs e) { MessageBox.Show(ex.Message); } - }); - Task UITask = task.ContinueWith((t) => - { progressBar.Hide(); comboBoxOverlayProcType.Enabled = true; buttonDownload.Enabled = true; UpdateOverlayProc(); CheckUpdate(); SaveSettings(); - }, TaskScheduler.FromCurrentSynchronizationContext()); + }); }; //+= new AsyncCompletedEventHandler(Completed); webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged); @@ -2761,16 +2829,13 @@ private void Completed(object sender, AsyncCompletedEventArgs e) { MessageBox.Show(ex.Message); } - }); - Task UITask = task.ContinueWith((t) => - { progressBar.Hide(); comboBoxOverlayProcType.Enabled = true; buttonDownload.Enabled = true; UpdateOverlayProc(); CheckUpdate(); SaveSettings(); - }, TaskScheduler.FromCurrentSynchronizationContext()); + }); } private void buttonStartStopOverlayProc_Click(object sender, EventArgs e) @@ -2823,49 +2888,55 @@ public bool captureRequest(String id_) private void buttonOverlay_Click(object sender, EventArgs e) { - if (FileSkinListView.SelectedItems.Count > 0) + lock (FileSkinListView) { - string url = (string)FileSkinListView.SelectedItems[0].Tag; - SendMessage(JObject.FromObject(new + lock (WebSkinListView) { - cmd = "set", - value = new + if (FileSkinListView.SelectedItems.Count > 0) { - opacity = 1.0, - zoom = 1.0, - fps = 30.0, - hide = false, - useDragFilter = true, - useDragMove = true, - useResizeGrip = true, - NoActivate = false, - Transparent = false, - url = getURLPath(url, false), - title = FileSkinListView.SelectedItems[0].Text + string url = (string)FileSkinListView.SelectedItems[0].Tag; + SendMessage(JObject.FromObject(new + { + cmd = "set", + value = new + { + opacity = 1.0, + zoom = 1.0, + fps = 30.0, + hide = false, + useDragFilter = true, + useDragMove = true, + useResizeGrip = true, + NoActivate = false, + Transparent = false, + url = getURLPath(url, false), + title = FileSkinListView.SelectedItems[0].Text + } + })); } - })); - } - else if (WebSkinListView.SelectedItems.Count > 0) - { - string url = (string)WebSkinListView.SelectedItems[0].Tag; - SendMessage(JObject.FromObject(new - { - cmd = "set", - value = new + else if (WebSkinListView.SelectedItems.Count > 0) { - opacity = 1.0, - zoom = 1.0, - fps = 30.0, - hide = false, - useDragFilter = true, - useDragMove = true, - useResizeGrip = true, - NoActivate = false, - Transparent = false, - url = getURLPath(url, false), - title = WebSkinListView.SelectedItems[0].Text + string url = (string)WebSkinListView.SelectedItems[0].Tag; + SendMessage(JObject.FromObject(new + { + cmd = "set", + value = new + { + opacity = 1.0, + zoom = 1.0, + fps = 30.0, + hide = false, + useDragFilter = true, + useDragMove = true, + useResizeGrip = true, + NoActivate = false, + Transparent = false, + url = getURLPath(url, false), + title = WebSkinListView.SelectedItems[0].Text + } + })); } - })); + } } } @@ -2884,29 +2955,32 @@ private void ServerUrlChanged() Hostname = hostnames.Text; if (core != null) { - lock (core.skinObject) + Task task = Task.Factory.StartNew(() => { - JToken skinObject = core.skinObject.DeepClone(); - JArray urlConverted = new JArray(); - JArray array = (JArray)skinObject["URLList"]; - core.skinObject["Token"] = ACTWebSocketCore.randomDir; - if (array != null) + lock (core.skinObject) { - foreach (JToken obj in array) + JToken skinObject = core.skinObject.DeepClone(); + JArray urlConverted = new JArray(); + JArray array = (JArray)skinObject["URLList"]; + core.skinObject["Token"] = ACTWebSocketCore.randomDir; + if (array != null) + { + foreach (JToken obj in array) + { + obj["URL"] = getURLPath(obj["URL"].ToObject<String>(), false); + } + } + else { - obj["URL"] = getURLPath(obj["URL"].ToObject<String>(), false); + skinObject["URLList"] = new JArray(); } + SendMessage(JObject.FromObject(new + { + cmd = "urllist", + value = skinObject + })); } - else - { - skinObject["URLList"] = new JArray(); - } - SendMessage(JObject.FromObject(new - { - cmd = "urllist", - value = skinObject - })); - } + }); } } @@ -3006,6 +3080,8 @@ private void buttonDXInstall_Click(object sender, EventArgs e) string savefile = Directory.GetParent(gamepath.Text).FullName + "/ACTWebsocketOverlay_latest.zip"; WebClient webClient = new WebClient(); + webClient.Headers["User-Agent"] = "ACTWebSocket (" + currentVersionString + ")"; + dx_progress.Value = 0; dx_progress.Minimum = 0; dx_progress.Maximum = 100; @@ -3107,15 +3183,13 @@ private void buttonDXInstall_Click(object sender, EventArgs e) { MessageBox.Show(ex.Message); } - }); - Task UITask = task.ContinueWith((t) => - { + buttonDXInstall.Enabled = true; gamepath.Enabled = true; game.Enabled = true; OverlayVersionCheck(gamepath.Text); SaveSettings(); - }, TaskScheduler.FromCurrentSynchronizationContext()); + }); }; //+= new AsyncCompletedEventHandler(Completed); webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(OverlayProgressChanged); @@ -3134,6 +3208,52 @@ private void buttonDXInstall_Click(object sender, EventArgs e) } } + private void buttonUninstall_Click(object sender, EventArgs e) + { + try + { + string extractDir = Directory.GetParent(gamepath.Text).FullName; + string versionFile = Directory.GetParent(gamepath.Text).FullName + "/overlay_version"; + string filename = Path.GetFileNameWithoutExtension(gamepath.Text); + System.IO.File.Delete(versionFile); + switch (game.SelectedIndex) + { + //32bit dx9 + case 0: + System.IO.File.Delete(extractDir + "/d3d9.dll"); + System.IO.File.Delete(extractDir + "/" + filename + "_mod.dll"); + break; + //32bit dx11 + case 1: + System.IO.File.Delete(extractDir + "/dxgi.dll"); + System.IO.File.Delete(extractDir + "/" + filename + "_mod.dll"); + break; + //64bit dx9 + case 2: + System.IO.File.Delete(extractDir + "/d3d9.dll"); + System.IO.File.Delete(extractDir + "/" + filename + "_mod.dll"); + break; + //64bit dx11 + case 3: + System.IO.File.Delete(extractDir + "/dxgi.dll"); + System.IO.File.Delete(extractDir + "/" + filename + "_mod.dll"); + break; + //ffxiv + case 4: + System.IO.File.Delete(extractDir + "/d3d9.dll"); + System.IO.File.Delete(extractDir + "/dxgi.dll"); + System.IO.File.Delete(extractDir + "/ffxiv_mod.dll"); + System.IO.File.Delete(extractDir + "/ffxiv_dx11_mod.dll"); + break; + } + OverlayVersionCheck(gamepath.Text); + } + catch(Exception ex) + { + MessageBox.Show(ex.Message); + } + } + private void OverlayProgressChanged(object sender, DownloadProgressChangedEventArgs e) { if (e.TotalBytesToReceive == -1) @@ -3183,7 +3303,7 @@ void OverlayVersionCheck(String filepath = null) } catch (Exception ex) { - + currentOverlayVersion.Text = currentOverlayVersionString = ""; } Task task2 = Task.Factory.StartNew(() => @@ -3196,9 +3316,6 @@ void OverlayVersionCheck(String filepath = null) { } - }); - Task UITask2 = task2.ContinueWith((t) => - { //develVersion.Text = latestTag + "." + develVersion; try { @@ -3209,7 +3326,7 @@ void OverlayVersionCheck(String filepath = null) { } - }, TaskScheduler.FromCurrentSynchronizationContext()); + }); Task task3 = Task.Factory.StartNew(() => { @@ -3221,9 +3338,6 @@ void OverlayVersionCheck(String filepath = null) { } - }); - Task UITask3 = task3.ContinueWith((t) => - { //develVersion.Text = latestTag + "." + develVersion; try { @@ -3234,7 +3348,8 @@ void OverlayVersionCheck(String filepath = null) { } - }, TaskScheduler.FromCurrentSynchronizationContext()); + }); } + } } diff --git a/ACTWebSocket.Core/ACTWebSocket.resx b/ACTWebSocket.Core/ACTWebSocket.resx index 4221158..7b2223f 100644 --- a/ACTWebSocket.Core/ACTWebSocket.resx +++ b/ACTWebSocket.Core/ACTWebSocket.resx @@ -1971,198 +1971,6 @@ <data name=">>tabPage1.ZOrder" xml:space="preserve"> <value>0</value> </data> - <data name=">>groupBox7.Name" xml:space="preserve"> - <value>groupBox7</value> - </data> - <data name=">>groupBox7.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=">>groupBox7.Parent" xml:space="preserve"> - <value>tabPage2</value> - </data> - <data name=">>groupBox7.ZOrder" xml:space="preserve"> - <value>0</value> - </data> - <data name=">>groupBox6.Name" xml:space="preserve"> - <value>groupBox6</value> - </data> - <data name=">>groupBox6.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=">>groupBox6.Parent" xml:space="preserve"> - <value>tabPage2</value> - </data> - <data name=">>groupBox6.ZOrder" xml:space="preserve"> - <value>1</value> - </data> - <data name="tabPage2.Location" type="System.Drawing.Point, System.Drawing"> - <value>4, 22</value> - </data> - <data name="tabPage2.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms"> - <value>3, 3, 3, 3</value> - </data> - <data name="tabPage2.Size" type="System.Drawing.Size, System.Drawing"> - <value>421, 434</value> - </data> - <data name="tabPage2.TabIndex" type="System.Int32, mscorlib"> - <value>1</value> - </data> - <data name="tabPage2.Text" xml:space="preserve"> - <value>DirectX Based</value> - </data> - <data name=">>tabPage2.Name" xml:space="preserve"> - <value>tabPage2</value> - </data> - <data name=">>tabPage2.Type" xml:space="preserve"> - <value>System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> - </data> - <data name=">>tabPage2.Parent" xml:space="preserve"> - <value>overlayTab</value> - </data> - <data name=">>tabPage2.ZOrder" xml:space="preserve"> - <value>1</value> - </data> - <data name="overlayTab.Location" type="System.Drawing.Point, System.Drawing"> - <value>258, 3</value> - </data> - <data name="overlayTab.Size" type="System.Drawing.Size, System.Drawing"> - <value>429, 460</value> - </data> - <data name="overlayTab.TabIndex" type="System.Int32, mscorlib"> - <value>10</value> - </data> - <data name=">>overlayTab.Name" xml:space="preserve"> - <value>overlayTab</value> - </data> - <data name=">>overlayTab.Type" xml:space="preserve"> - <value>System.Windows.Forms.TabControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> - </data> - <data name=">>overlayTab.Parent" xml:space="preserve"> - <value>$this</value> - </data> - <data name=">>overlayTab.ZOrder" xml:space="preserve"> - <value>1</value> - </data> - <data name=">>buttonOverlayVersionCheck.Name" xml:space="preserve"> - <value>buttonOverlayVersionCheck</value> - </data> - <data name=">>buttonOverlayVersionCheck.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=">>buttonOverlayVersionCheck.Parent" xml:space="preserve"> - <value>groupBox7</value> - </data> - <data name=">>buttonOverlayVersionCheck.ZOrder" xml:space="preserve"> - <value>0</value> - </data> - <data name=">>labelOverlayLatest.Name" xml:space="preserve"> - <value>labelOverlayLatest</value> - </data> - <data name=">>labelOverlayLatest.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=">>labelOverlayLatest.Parent" xml:space="preserve"> - <value>groupBox7</value> - </data> - <data name=">>labelOverlayLatest.ZOrder" xml:space="preserve"> - <value>1</value> - </data> - <data name=">>latestOverlayVersion.Name" xml:space="preserve"> - <value>latestOverlayVersion</value> - </data> - <data name=">>latestOverlayVersion.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=">>latestOverlayVersion.Parent" xml:space="preserve"> - <value>groupBox7</value> - </data> - <data name=">>latestOverlayVersion.ZOrder" xml:space="preserve"> - <value>2</value> - </data> - <data name=">>labelOverlayRelease.Name" xml:space="preserve"> - <value>labelOverlayRelease</value> - </data> - <data name=">>labelOverlayRelease.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=">>labelOverlayRelease.Parent" xml:space="preserve"> - <value>groupBox7</value> - </data> - <data name=">>labelOverlayRelease.ZOrder" xml:space="preserve"> - <value>3</value> - </data> - <data name=">>labelOverlayCurrent.Name" xml:space="preserve"> - <value>labelOverlayCurrent</value> - </data> - <data name=">>labelOverlayCurrent.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=">>labelOverlayCurrent.Parent" xml:space="preserve"> - <value>groupBox7</value> - </data> - <data name=">>labelOverlayCurrent.ZOrder" xml:space="preserve"> - <value>4</value> - </data> - <data name=">>currentOverlayVersion.Name" xml:space="preserve"> - <value>currentOverlayVersion</value> - </data> - <data name=">>currentOverlayVersion.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=">>currentOverlayVersion.Parent" xml:space="preserve"> - <value>groupBox7</value> - </data> - <data name=">>currentOverlayVersion.ZOrder" xml:space="preserve"> - <value>5</value> - </data> - <data name=">>buttonOverlayGitHub.Name" xml:space="preserve"> - <value>buttonOverlayGitHub</value> - </data> - <data name=">>buttonOverlayGitHub.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=">>buttonOverlayGitHub.Parent" xml:space="preserve"> - <value>groupBox7</value> - </data> - <data name=">>buttonOverlayGitHub.ZOrder" xml:space="preserve"> - <value>6</value> - </data> - <data name=">>releaseOverlayVersion.Name" xml:space="preserve"> - <value>releaseOverlayVersion</value> - </data> - <data name=">>releaseOverlayVersion.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=">>releaseOverlayVersion.Parent" xml:space="preserve"> - <value>groupBox7</value> - </data> - <data name=">>releaseOverlayVersion.ZOrder" xml:space="preserve"> - <value>7</value> - </data> - <data name="groupBox7.Location" type="System.Drawing.Point, System.Drawing"> - <value>12, 254</value> - </data> - <data name="groupBox7.Size" type="System.Drawing.Size, System.Drawing"> - <value>186, 165</value> - </data> - <data name="groupBox7.TabIndex" type="System.Int32, mscorlib"> - <value>34</value> - </data> - <data name="groupBox7.Text" xml:space="preserve"> - <value>Version</value> - </data> - <data name=">>groupBox7.Name" xml:space="preserve"> - <value>groupBox7</value> - </data> - <data name=">>groupBox7.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=">>groupBox7.Parent" xml:space="preserve"> - <value>tabPage2</value> - </data> - <data name=">>groupBox7.ZOrder" xml:space="preserve"> - <value>0</value> - </data> <data name="buttonOverlayVersionCheck.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms"> <value>NoControl</value> </data> @@ -2370,136 +2178,55 @@ <data name=">>releaseOverlayVersion.ZOrder" xml:space="preserve"> <value>7</value> </data> - <data name=">>buttonFindDirectory.Name" xml:space="preserve"> - <value>buttonFindDirectory</value> - </data> - <data name=">>buttonFindDirectory.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=">>buttonFindDirectory.Parent" xml:space="preserve"> - <value>groupBox6</value> - </data> - <data name=">>buttonFindDirectory.ZOrder" xml:space="preserve"> - <value>0</value> - </data> - <data name=">>gamepath.Name" xml:space="preserve"> - <value>gamepath</value> - </data> - <data name=">>gamepath.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=">>gamepath.Parent" xml:space="preserve"> - <value>groupBox6</value> - </data> - <data name=">>gamepath.ZOrder" xml:space="preserve"> - <value>1</value> - </data> - <data name=">>label5.Name" xml:space="preserve"> - <value>label5</value> - </data> - <data name=">>label5.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=">>label5.Parent" xml:space="preserve"> - <value>groupBox6</value> - </data> - <data name=">>label5.ZOrder" xml:space="preserve"> - <value>2</value> - </data> - <data name=">>label4.Name" xml:space="preserve"> - <value>label4</value> + <data name="groupBox7.Location" type="System.Drawing.Point, System.Drawing"> + <value>6, 251</value> </data> - <data name=">>label4.Type" xml:space="preserve"> - <value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + <data name="groupBox7.Size" type="System.Drawing.Size, System.Drawing"> + <value>186, 165</value> </data> - <data name=">>label4.Parent" xml:space="preserve"> - <value>groupBox6</value> + <data name="groupBox7.TabIndex" type="System.Int32, mscorlib"> + <value>34</value> </data> - <data name=">>label4.ZOrder" xml:space="preserve"> - <value>3</value> + <data name="groupBox7.Text" xml:space="preserve"> + <value>Version</value> </data> - <data name=">>label3.Name" xml:space="preserve"> - <value>label3</value> + <data name=">>groupBox7.Name" xml:space="preserve"> + <value>groupBox7</value> </data> - <data name=">>label3.Type" xml:space="preserve"> - <value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + <data name=">>groupBox7.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=">>label3.Parent" xml:space="preserve"> + <data name=">>groupBox7.Parent" xml:space="preserve"> <value>groupBox6</value> </data> - <data name=">>label3.ZOrder" xml:space="preserve"> - <value>4</value> - </data> - <data name=">>game.Name" xml:space="preserve"> - <value>game</value> - </data> - <data name=">>game.Type" xml:space="preserve"> - <value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> - </data> - <data name=">>game.Parent" xml:space="preserve"> - <value>groupBox6</value> + <data name=">>groupBox7.ZOrder" xml:space="preserve"> + <value>0</value> </data> - <data name=">>game.ZOrder" xml:space="preserve"> - <value>5</value> + <data name="buttonUninstall.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms"> + <value>NoControl</value> </data> - <data name=">>textBox1.Name" xml:space="preserve"> - <value>textBox1</value> + <data name="buttonUninstall.Location" type="System.Drawing.Point, System.Drawing"> + <value>328, 130</value> </data> - <data name=">>textBox1.Type" xml:space="preserve"> - <value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + <data name="buttonUninstall.Size" type="System.Drawing.Size, System.Drawing"> + <value>71, 25</value> </data> - <data name=">>textBox1.Parent" xml:space="preserve"> - <value>groupBox6</value> + <data name="buttonUninstall.TabIndex" type="System.Int32, mscorlib"> + <value>30</value> </data> - <data name=">>textBox1.ZOrder" xml:space="preserve"> - <value>6</value> + <data name="buttonUninstall.Text" xml:space="preserve"> + <value>Uninstall</value> </data> - <data name=">>buttonDXInstall.Name" xml:space="preserve"> - <value>buttonDXInstall</value> + <data name=">>buttonUninstall.Name" xml:space="preserve"> + <value>buttonUninstall</value> </data> - <data name=">>buttonDXInstall.Type" xml:space="preserve"> + <data name=">>buttonUninstall.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=">>buttonDXInstall.Parent" xml:space="preserve"> - <value>groupBox6</value> - </data> - <data name=">>buttonDXInstall.ZOrder" xml:space="preserve"> - <value>7</value> - </data> - <data name=">>dx_progress.Name" xml:space="preserve"> - <value>dx_progress</value> - </data> - <data name=">>dx_progress.Type" xml:space="preserve"> - <value>System.Windows.Forms.ProgressBar, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> - </data> - <data name=">>dx_progress.Parent" xml:space="preserve"> - <value>groupBox6</value> - </data> - <data name=">>dx_progress.ZOrder" xml:space="preserve"> - <value>8</value> - </data> - <data name="groupBox6.Location" type="System.Drawing.Point, System.Drawing"> - <value>6, 6</value> - </data> - <data name="groupBox6.Size" type="System.Drawing.Size, System.Drawing"> - <value>404, 242</value> - </data> - <data name="groupBox6.TabIndex" type="System.Int32, mscorlib"> - <value>34</value> - </data> - <data name="groupBox6.Text" xml:space="preserve"> - <value>dear imgui Overlay</value> - </data> - <data name=">>groupBox6.Name" xml:space="preserve"> + <data name=">>buttonUninstall.Parent" xml:space="preserve"> <value>groupBox6</value> </data> - <data name=">>groupBox6.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=">>groupBox6.Parent" xml:space="preserve"> - <value>tabPage2</value> - </data> - <data name=">>groupBox6.ZOrder" xml:space="preserve"> + <data name=">>buttonUninstall.ZOrder" xml:space="preserve"> <value>1</value> </data> <data name="buttonFindDirectory.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms"> @@ -2527,7 +2254,7 @@ <value>groupBox6</value> </data> <data name=">>buttonFindDirectory.ZOrder" xml:space="preserve"> - <value>0</value> + <value>2</value> </data> <data name="gamepath.Location" type="System.Drawing.Point, System.Drawing"> <value>114, 56</value> @@ -2548,7 +2275,7 @@ <value>groupBox6</value> </data> <data name=">>gamepath.ZOrder" xml:space="preserve"> - <value>1</value> + <value>3</value> </data> <data name="label5.AutoSize" type="System.Boolean, mscorlib"> <value>True</value> @@ -2578,7 +2305,7 @@ <value>groupBox6</value> </data> <data name=">>label5.ZOrder" xml:space="preserve"> - <value>2</value> + <value>4</value> </data> <data name="label4.Location" type="System.Drawing.Point, System.Drawing"> <value>0, 0</value> @@ -2599,7 +2326,7 @@ <value>groupBox6</value> </data> <data name=">>label4.ZOrder" xml:space="preserve"> - <value>3</value> + <value>5</value> </data> <data name="label3.AutoSize" type="System.Boolean, mscorlib"> <value>True</value> @@ -2626,7 +2353,7 @@ <value>groupBox6</value> </data> <data name=">>label3.ZOrder" xml:space="preserve"> - <value>4</value> + <value>6</value> </data> <data name="game.Items" xml:space="preserve"> <value>32bit dx9</value> @@ -2662,7 +2389,7 @@ <value>groupBox6</value> </data> <data name=">>game.ZOrder" xml:space="preserve"> - <value>5</value> + <value>7</value> </data> <data name="textBox1.Location" type="System.Drawing.Point, System.Drawing"> <value>0, 0</value> @@ -2683,7 +2410,7 @@ <value>groupBox6</value> </data> <data name=">>textBox1.ZOrder" xml:space="preserve"> - <value>6</value> + <value>8</value> </data> <data name="buttonDXInstall.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms"> <value>NoControl</value> @@ -2698,7 +2425,7 @@ <value>19</value> </data> <data name="buttonDXInstall.Text" xml:space="preserve"> - <value>Download</value> + <value>Install</value> </data> <data name=">>buttonDXInstall.Name" xml:space="preserve"> <value>buttonDXInstall</value> @@ -2710,7 +2437,7 @@ <value>groupBox6</value> </data> <data name=">>buttonDXInstall.ZOrder" xml:space="preserve"> - <value>7</value> + <value>9</value> </data> <data name="dx_progress.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms"> <value>NoControl</value> @@ -2734,7 +2461,79 @@ <value>groupBox6</value> </data> <data name=">>dx_progress.ZOrder" xml:space="preserve"> - <value>8</value> + <value>10</value> + </data> + <data name="groupBox6.Location" type="System.Drawing.Point, System.Drawing"> + <value>6, 6</value> + </data> + <data name="groupBox6.Size" type="System.Drawing.Size, System.Drawing"> + <value>404, 422</value> + </data> + <data name="groupBox6.TabIndex" type="System.Int32, mscorlib"> + <value>34</value> + </data> + <data name="groupBox6.Text" xml:space="preserve"> + <value>dear imgui Overlay</value> + </data> + <data name=">>groupBox6.Name" xml:space="preserve"> + <value>groupBox6</value> + </data> + <data name=">>groupBox6.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=">>groupBox6.Parent" xml:space="preserve"> + <value>tabPage2</value> + </data> + <data name=">>groupBox6.ZOrder" xml:space="preserve"> + <value>0</value> + </data> + <data name="tabPage2.Location" type="System.Drawing.Point, System.Drawing"> + <value>4, 22</value> + </data> + <data name="tabPage2.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms"> + <value>3, 3, 3, 3</value> + </data> + <data name="tabPage2.Size" type="System.Drawing.Size, System.Drawing"> + <value>421, 434</value> + </data> + <data name="tabPage2.TabIndex" type="System.Int32, mscorlib"> + <value>1</value> + </data> + <data name="tabPage2.Text" xml:space="preserve"> + <value>DirectX Based</value> + </data> + <data name=">>tabPage2.Name" xml:space="preserve"> + <value>tabPage2</value> + </data> + <data name=">>tabPage2.Type" xml:space="preserve"> + <value>System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </data> + <data name=">>tabPage2.Parent" xml:space="preserve"> + <value>overlayTab</value> + </data> + <data name=">>tabPage2.ZOrder" xml:space="preserve"> + <value>1</value> + </data> + <data name="overlayTab.Location" type="System.Drawing.Point, System.Drawing"> + <value>258, 3</value> + </data> + <data name="overlayTab.Size" type="System.Drawing.Size, System.Drawing"> + <value>429, 460</value> + </data> + <data name="overlayTab.TabIndex" type="System.Int32, mscorlib"> + <value>10</value> + </data> + <data name=">>overlayTab.Name" xml:space="preserve"> + <value>overlayTab</value> + </data> + <data name=">>overlayTab.Type" xml:space="preserve"> + <value>System.Windows.Forms.TabControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </data> + <data name=">>overlayTab.Parent" xml:space="preserve"> + <value>$this</value> + </data> + <data name=">>overlayTab.ZOrder" xml:space="preserve"> + <value>1</value> </data> <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> diff --git a/ACTWebSocket.Core/ACTWebSocketCore.cs b/ACTWebSocket.Core/ACTWebSocketCore.cs index c45c5f0..4c2cfa3 100644 --- a/ACTWebSocket.Core/ACTWebSocketCore.cs +++ b/ACTWebSocket.Core/ACTWebSocketCore.cs @@ -1,12 +1,14 @@ using Advanced_Combat_Tracker; using Newtonsoft.Json.Linq; using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security.Cryptography.X509Certificates; using System.Text; +using System.Threading; using System.Threading.Tasks; using System.Timers; using WebSocketSharp; @@ -17,6 +19,7 @@ namespace ACTWebSocket_Plugin { public partial class ACTWebSocketCore { + public static String currentVersionString = ""; ACTWebSocketMain gui = null; public ACTWebSocketCore(ACTWebSocketMain gui) { @@ -26,8 +29,8 @@ public ACTWebSocketCore(ACTWebSocketMain gui) public Dictionary<string, bool> Filters = new Dictionary<string, bool>(); public static FFXIV_OverlayAPI overlayAPI; public HttpServer httpServer = null; - Timer updateTimer = null; - Timer pingTimer = null; + System.Timers.Timer updateTimer = null; + System.Timers.Timer pingTimer = null; internal IntPtr hwnd; public JObject skinObject = new JObject(); static public string randomDir = null; @@ -73,7 +76,7 @@ void InitUpdate() 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) @@ -87,7 +90,7 @@ internal void StartServer(string address, int port, int extPort, string domain = // new X509Certificate2("/path/to/cert.pfx", "password for cert.pfx"); string parent_path = ""; - if(randomDir != null) + if (randomDir != null) { parent_path = "/" + randomDir; } @@ -119,7 +122,7 @@ internal void StartServer(string address, int port, int extPort, string domain = var req = e.Request; }; - EventHandler < HttpRequestEventArgs > onget = (sender, e) => + EventHandler<HttpRequestEventArgs> onget = (sender, e) => { try { @@ -175,7 +178,7 @@ internal void StartServer(string address, int port, int extPort, string domain = obj["URL"] = gui.getURLPath(obj["URL"].ToObject<String>(), gui.RandomURL); } } - res.WriteContent(res.ContentEncoding.GetBytes(clone.ToString())); + res.WriteContent(res.ContentEncoding.GetBytes(clone.ToString(Newtonsoft.Json.Formatting.None))); } } else @@ -232,7 +235,7 @@ internal void StartServer(string address, int port, int extPort, string domain = res.WriteContent(content); } - catch(Exception ex) + catch (Exception ex) { // TODO: } @@ -253,7 +256,7 @@ internal void StartServer(string address, int port, int extPort, string domain = httpServer.Start(); - pingTimer = new Timer(); + pingTimer = new System.Timers.Timer(); pingTimer.Interval = 2000; pingTimer.Elapsed += (o, e) => { @@ -271,7 +274,7 @@ internal void StartServer(string address, int port, int extPort, string domain = }; pingTimer.Start(); - updateTimer = new Timer(); + updateTimer = new System.Timers.Timer(); updateTimer.Interval = 1000; updateTimer.Elapsed += (o, e) => { @@ -313,7 +316,6 @@ internal void StopServer() pingTimer.Close(); pingTimer = null; } - } internal void Broadcast(string v, string type, JToken message) @@ -336,11 +338,8 @@ internal void Broadcast(string v, string type, JToken message) obj["type"] = "broadcast"; obj["msgtype"] = type; obj["msg"] = message; - String str = obj.ToString(); - lock (s) - { - s.Sessions.Broadcast(str); - } + String str = obj.ToString(Newtonsoft.Json.Formatting.None); + s.Sessions.BroadcastAsync(str, null); } } } diff --git a/ACTWebSocket.Core/Functions/Utility.cs b/ACTWebSocket.Core/Functions/Utility.cs index 422c804..96d2cff 100644 --- a/ACTWebSocket.Core/Functions/Utility.cs +++ b/ACTWebSocket.Core/Functions/Utility.cs @@ -1,4 +1,5 @@ -using System; +using ACTWebSocket_Plugin; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -87,6 +88,8 @@ public static String GetExternalIp() string whatIsMyIp = "https://api.ipify.org"; ToggleAllowUnsafeHeaderParsing(true); WebClient wc = new WebClient(); + wc.Headers["User-Agent"] = "ACTWebSocket (" + ACTWebSocketCore.currentVersionString + ")"; + UTF8Encoding utf8 = new UTF8Encoding(); string ipAddress = ""; try @@ -103,6 +106,7 @@ public static String ReleaseTag(string releaseURL = "https://github.com/ZCube/AC { ToggleAllowUnsafeHeaderParsing(true); WebClient wc = new WebClient(); + wc.Headers["User-Agent"] = "ACTWebSocket (" + ACTWebSocketCore.currentVersionString + ")"; UTF8Encoding utf8 = new UTF8Encoding(); ///ZCube/ACTWebSocket/tree/ string releaseTag = null; @@ -123,6 +127,7 @@ public static String DevelVersion(string versionURL = "https://www.dropbox.com/s { ToggleAllowUnsafeHeaderParsing(true); WebClient wc = new WebClient(); + wc.Headers["User-Agent"] = "ACTWebSocket (" + ACTWebSocketCore.currentVersionString + ")"; UTF8Encoding utf8 = new UTF8Encoding(); ///ZCube/ACTWebSocket/tree/ string version = null; diff --git a/ACTWebSocket.Core/WebSocketCommunicateBehavior.cs b/ACTWebSocket.Core/WebSocketCommunicateBehavior.cs index 05c3148..5ce8f2b 100644 --- a/ACTWebSocket.Core/WebSocketCommunicateBehavior.cs +++ b/ACTWebSocket.Core/WebSocketCommunicateBehavior.cs @@ -107,12 +107,12 @@ public static JObject GenMessage(String type, String from, String to, String msg public void Broadcast(String from, String msgtype, JToken message) { JObject obj = new JObject(); - String str = GenMessage("broadcast", from, msgtype, message).ToString(); + String str = GenMessage("broadcast", from, msgtype, message).ToString(Newtonsoft.Json.Formatting.None); foreach (WebSocketCommunicateBehavior s in Sessions.Sessions) { if (s.id != from) { - s.Send(str); + s.SendAsync(str, null); } } } @@ -120,12 +120,12 @@ public void Broadcast(String from, String msgtype, JToken message) public void Broadcast(String msgtype, JToken message) { String from = id; - String str = GenMessage("broadcast", from, msgtype, message).ToString(); + String str = GenMessage("broadcast", from, msgtype, message).ToString(Newtonsoft.Json.Formatting.None); foreach (WebSocketCommunicateBehavior s in Sessions.Sessions) { if (s.id != from) { - s.Send(str); + s.SendAsync(str, null); } } } @@ -133,12 +133,12 @@ public void Broadcast(String msgtype, JToken message) public void Send(String to, String msgtype, JToken message) { String from = id; - String str = GenMessage("send", from, to, msgtype, message).ToString(); + String str = GenMessage("send", from, to, msgtype, message).ToString(Newtonsoft.Json.Formatting.None); foreach (WebSocketCommunicateBehavior s in Sessions.Sessions) { if (s.id == to) { - s.Send(str); + s.SendAsync(str, null); break; } } @@ -147,12 +147,12 @@ public void Send(String to, String msgtype, JToken message) public void Send(String from, String to, String msgtype, JToken message) { JObject obj = new JObject(); - String str = GenMessage("send", from, to, msgtype, message).ToString(); + String str = GenMessage("send", from, to, msgtype, message).ToString(Newtonsoft.Json.Formatting.None); foreach (WebSocketCommunicateBehavior s in Sessions.Sessions) { if (s.id == to) { - s.Send(str); + s.SendAsync(str, null); break; } } @@ -161,12 +161,12 @@ public void Send(String from, String to, String msgtype, JToken message) public void Send(String type, String from, String to, String msgtype, JToken message) { JObject obj = new JObject(); - String str = GenMessage(type, from, to, msgtype, message).ToString(); + String str = GenMessage(type, from, to, msgtype, message).ToString(Newtonsoft.Json.Formatting.None); foreach (WebSocketCommunicateBehavior s in Sessions.Sessions) { if (s.id == to) { - s.Send(str); + s.SendAsync(str, null); break; } } diff --git a/ACTWebSocket.Core/app.config b/ACTWebSocket.Core/app.config new file mode 100644 index 0000000..8460dd4 --- /dev/null +++ b/ACTWebSocket.Core/app.config @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration> \ No newline at end of file diff --git a/ACTWebSocket.Loader/ACTWebSocket.csproj b/ACTWebSocket.Loader/ACTWebSocket.csproj index e8020cf..dff5d0a 100644 --- a/ACTWebSocket.Loader/ACTWebSocket.csproj +++ b/ACTWebSocket.Loader/ACTWebSocket.csproj @@ -52,6 +52,7 @@ <PlatformTarget>x64</PlatformTarget> <ErrorReport>prompt</ErrorReport> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> + <Prefer32Bit>false</Prefer32Bit> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> <OutputPath>bin\x64\Release\</OutputPath> @@ -61,6 +62,7 @@ <PlatformTarget>x64</PlatformTarget> <ErrorReport>prompt</ErrorReport> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> + <Prefer32Bit>false</Prefer32Bit> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> <DebugSymbols>true</DebugSymbols> @@ -70,6 +72,7 @@ <PlatformTarget>x86</PlatformTarget> <ErrorReport>prompt</ErrorReport> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> + <Prefer32Bit>false</Prefer32Bit> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> <OutputPath>bin\x86\Release\</OutputPath> @@ -79,6 +82,7 @@ <PlatformTarget>x86</PlatformTarget> <ErrorReport>prompt</ErrorReport> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> + <Prefer32Bit>false</Prefer32Bit> </PropertyGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. diff --git a/ACTWebSocket.Loader/App.config b/ACTWebSocket.Loader/App.config index c94178c..bef76da 100644 --- a/ACTWebSocket.Loader/App.config +++ b/ACTWebSocket.Loader/App.config @@ -6,4 +6,13 @@ <bindingRedirect oldVersion="2.5.0.0-3.65535.65535.65535" newVersion="3.2.0.250"/> </dependentAssembly> </assemblyBinding> -<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup></configuration> +<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/> + <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0"/> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration>