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]*?)\", 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 tasklist = new List();
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 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 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(), false);
+ }
+ }
+ else
{
- obj["URL"] = getURLPath(obj["URL"].ToObject(), 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 @@
0
-
- groupBox7
-
-
- System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- tabPage2
-
-
- 0
-
-
- groupBox6
-
-
- System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- tabPage2
-
-
- 1
-
-
- 4, 22
-
-
- 3, 3, 3, 3
-
-
- 421, 434
-
-
- 1
-
-
- DirectX Based
-
-
- tabPage2
-
-
- System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- overlayTab
-
-
- 1
-
-
- 258, 3
-
-
- 429, 460
-
-
- 10
-
-
- overlayTab
-
-
- System.Windows.Forms.TabControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- $this
-
-
- 1
-
-
- buttonOverlayVersionCheck
-
-
- System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- groupBox7
-
-
- 0
-
-
- labelOverlayLatest
-
-
- System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- groupBox7
-
-
- 1
-
-
- latestOverlayVersion
-
-
- System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- groupBox7
-
-
- 2
-
-
- labelOverlayRelease
-
-
- System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- groupBox7
-
-
- 3
-
-
- labelOverlayCurrent
-
-
- System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- groupBox7
-
-
- 4
-
-
- currentOverlayVersion
-
-
- System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- groupBox7
-
-
- 5
-
-
- buttonOverlayGitHub
-
-
- System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- groupBox7
-
-
- 6
-
-
- releaseOverlayVersion
-
-
- System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- groupBox7
-
-
- 7
-
-
- 12, 254
-
-
- 186, 165
-
-
- 34
-
-
- Version
-
-
- groupBox7
-
-
- System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- tabPage2
-
-
- 0
-
NoControl
@@ -2370,136 +2178,55 @@
7
-
- buttonFindDirectory
-
-
- System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- groupBox6
-
-
- 0
-
-
- gamepath
-
-
- System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- groupBox6
-
-
- 1
-
-
- label5
-
-
- System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- groupBox6
-
-
- 2
-
-
- label4
+
+ 6, 251
-
- System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 186, 165
-
- groupBox6
+
+ 34
-
- 3
+
+ Version
-
- label3
+
+ groupBox7
-
- System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
groupBox6
-
- 4
-
-
- game
-
-
- System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- groupBox6
+
+ 0
-
- 5
+
+ NoControl
-
- textBox1
+
+ 328, 130
-
- System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 71, 25
-
- groupBox6
+
+ 30
-
- 6
+
+ Uninstall
-
- buttonDXInstall
+
+ buttonUninstall
-
+
System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- groupBox6
-
-
- 7
-
-
- dx_progress
-
-
- System.Windows.Forms.ProgressBar, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- groupBox6
-
-
- 8
-
-
- 6, 6
-
-
- 404, 242
-
-
- 34
-
-
- dear imgui Overlay
-
-
+
groupBox6
-
- System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- tabPage2
-
-
+
1
@@ -2527,7 +2254,7 @@
groupBox6
- 0
+ 2
114, 56
@@ -2548,7 +2275,7 @@
groupBox6
- 1
+ 3
True
@@ -2578,7 +2305,7 @@
groupBox6
- 2
+ 4
0, 0
@@ -2599,7 +2326,7 @@
groupBox6
- 3
+ 5
True
@@ -2626,7 +2353,7 @@
groupBox6
- 4
+ 6
32bit dx9
@@ -2662,7 +2389,7 @@
groupBox6
- 5
+ 7
0, 0
@@ -2683,7 +2410,7 @@
groupBox6
- 6
+ 8
NoControl
@@ -2698,7 +2425,7 @@
19
- Download
+ Install
buttonDXInstall
@@ -2710,7 +2437,7 @@
groupBox6
- 7
+ 9
NoControl
@@ -2734,7 +2461,79 @@
groupBox6
- 8
+ 10
+
+
+ 6, 6
+
+
+ 404, 422
+
+
+ 34
+
+
+ dear imgui Overlay
+
+
+ groupBox6
+
+
+ System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ tabPage2
+
+
+ 0
+
+
+ 4, 22
+
+
+ 3, 3, 3, 3
+
+
+ 421, 434
+
+
+ 1
+
+
+ DirectX Based
+
+
+ tabPage2
+
+
+ System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ overlayTab
+
+
+ 1
+
+
+ 258, 3
+
+
+ 429, 460
+
+
+ 10
+
+
+ overlayTab
+
+
+ System.Windows.Forms.TabControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ $this
+
+
+ 1
True
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 Filters = new Dictionary();
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 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(), 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 @@
+
+
+
+
+
+
+
+
+
+
+
\ 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 @@
x64
prompt
MinimumRecommendedRules.ruleset
+ false
bin\x64\Release\
@@ -61,6 +62,7 @@
x64
prompt
MinimumRecommendedRules.ruleset
+ false
true
@@ -70,6 +72,7 @@
x86
prompt
MinimumRecommendedRules.ruleset
+ false
bin\x86\Release\
@@ -79,6 +82,7 @@
x86
prompt
MinimumRecommendedRules.ruleset
+ false