Skip to content
This repository was archived by the owner on Sep 2, 2019. It is now read-only.

Commit 72c9c6a

Browse files
committed
버전 체크 추가.
1 parent 53533d3 commit 72c9c6a

File tree

6 files changed

+916
-140
lines changed

6 files changed

+916
-140
lines changed

ACTWebSocket.Core/ACTWebSocket.cs

Lines changed: 202 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ namespace ACTWebSocket_Plugin
2727
using System.Runtime.InteropServices;
2828
using SharpCompress.Readers;
2929
using Microsoft.Win32;
30+
using System.Reflection;
3031

3132
public interface PluginDirectory
3233
{
@@ -67,6 +68,17 @@ public class ACTWebSocketMain : UserControl, IActPluginV1, PluginDirectory
6768
private TextBox updateLabel;
6869
private Button buttonInstall;
6970
private ComboBox comboBoxOverlayProcType;
71+
private GroupBox groupBox5;
72+
private Label labelLatest;
73+
private TextBox latestVersion;
74+
private Label labelRelease;
75+
private Label labelCurrent;
76+
private TextBox currentVersion;
77+
private Button buttonGitHub;
78+
private TextBox releaseVersion;
79+
private Button buttonLatest;
80+
private Button buttonRelease;
81+
private Button buttonVersionCheck;
7082
private CheckBox chatFilter;
7183

7284
public void SetSkinDir(string path)
@@ -84,6 +96,11 @@ public string GetSkinDir()
8496
return overlaySkinDirectory;
8597
}
8698

99+
public void SetPluginPath(string path)
100+
{
101+
pluginPath = path;
102+
}
103+
87104
public void SetPluginDirectory(string path)
88105
{
89106
overlayProcDir = path + "\\overlay_proc";
@@ -186,6 +203,17 @@ private void InitializeComponent()
186203
this.buttonCopyCode = new System.Windows.Forms.Button();
187204
this.label1 = new System.Windows.Forms.Label();
188205
this.hashCode = new System.Windows.Forms.TextBox();
206+
this.groupBox5 = new System.Windows.Forms.GroupBox();
207+
this.labelLatest = new System.Windows.Forms.Label();
208+
this.latestVersion = new System.Windows.Forms.TextBox();
209+
this.labelRelease = new System.Windows.Forms.Label();
210+
this.labelCurrent = new System.Windows.Forms.Label();
211+
this.currentVersion = new System.Windows.Forms.TextBox();
212+
this.buttonGitHub = new System.Windows.Forms.Button();
213+
this.releaseVersion = new System.Windows.Forms.TextBox();
214+
this.buttonVersionCheck = new System.Windows.Forms.Button();
215+
this.buttonRelease = new System.Windows.Forms.Button();
216+
this.buttonLatest = new System.Windows.Forms.Button();
189217
this.startoption.SuspendLayout();
190218
this.hostdata.SuspendLayout();
191219
this.othersets.SuspendLayout();
@@ -194,6 +222,7 @@ private void InitializeComponent()
194222
this.groupBox1.SuspendLayout();
195223
this.groupBox3.SuspendLayout();
196224
this.groupBox4.SuspendLayout();
225+
this.groupBox5.SuspendLayout();
197226
this.SuspendLayout();
198227
//
199228
// port
@@ -553,9 +582,87 @@ private void InitializeComponent()
553582
resources.ApplyResources(this.hashCode, "hashCode");
554583
this.hashCode.Name = "hashCode";
555584
//
585+
// groupBox5
586+
//
587+
this.groupBox5.Controls.Add(this.buttonLatest);
588+
this.groupBox5.Controls.Add(this.buttonRelease);
589+
this.groupBox5.Controls.Add(this.buttonVersionCheck);
590+
this.groupBox5.Controls.Add(this.labelLatest);
591+
this.groupBox5.Controls.Add(this.latestVersion);
592+
this.groupBox5.Controls.Add(this.labelRelease);
593+
this.groupBox5.Controls.Add(this.labelCurrent);
594+
this.groupBox5.Controls.Add(this.currentVersion);
595+
this.groupBox5.Controls.Add(this.buttonGitHub);
596+
this.groupBox5.Controls.Add(this.releaseVersion);
597+
resources.ApplyResources(this.groupBox5, "groupBox5");
598+
this.groupBox5.Name = "groupBox5";
599+
this.groupBox5.TabStop = false;
600+
//
601+
// labelLatest
602+
//
603+
resources.ApplyResources(this.labelLatest, "labelLatest");
604+
this.labelLatest.Name = "labelLatest";
605+
//
606+
// latestVersion
607+
//
608+
resources.ApplyResources(this.latestVersion, "latestVersion");
609+
this.latestVersion.Name = "latestVersion";
610+
this.latestVersion.ReadOnly = true;
611+
//
612+
// labelRelease
613+
//
614+
resources.ApplyResources(this.labelRelease, "labelRelease");
615+
this.labelRelease.Name = "labelRelease";
616+
//
617+
// labelCurrent
618+
//
619+
resources.ApplyResources(this.labelCurrent, "labelCurrent");
620+
this.labelCurrent.Name = "labelCurrent";
621+
//
622+
// currentVersion
623+
//
624+
resources.ApplyResources(this.currentVersion, "currentVersion");
625+
this.currentVersion.Name = "currentVersion";
626+
this.currentVersion.ReadOnly = true;
627+
//
628+
// buttonGitHub
629+
//
630+
resources.ApplyResources(this.buttonGitHub, "buttonGitHub");
631+
this.buttonGitHub.Name = "buttonGitHub";
632+
this.buttonGitHub.UseVisualStyleBackColor = true;
633+
this.buttonGitHub.Click += new System.EventHandler(this.buttonGitHub_Click);
634+
//
635+
// releaseVersion
636+
//
637+
resources.ApplyResources(this.releaseVersion, "releaseVersion");
638+
this.releaseVersion.Name = "releaseVersion";
639+
this.releaseVersion.ReadOnly = true;
640+
//
641+
// buttonVersionCheck
642+
//
643+
resources.ApplyResources(this.buttonVersionCheck, "buttonVersionCheck");
644+
this.buttonVersionCheck.Name = "buttonVersionCheck";
645+
this.buttonVersionCheck.UseVisualStyleBackColor = true;
646+
this.buttonVersionCheck.Click += new System.EventHandler(this.buttonVersionCheck_Click);
647+
//
648+
// buttonRelease
649+
//
650+
resources.ApplyResources(this.buttonRelease, "buttonRelease");
651+
this.buttonRelease.Name = "buttonRelease";
652+
this.buttonRelease.UseVisualStyleBackColor = true;
653+
this.buttonRelease.Click += new System.EventHandler(this.buttonRelease_Click);
654+
//
655+
// buttonLatest
656+
//
657+
resources.ApplyResources(this.buttonLatest, "buttonLatest");
658+
this.buttonLatest.Name = "buttonLatest";
659+
this.buttonLatest.UseVisualStyleBackColor = true;
660+
this.buttonLatest.Click += new System.EventHandler(this.buttonLatest_Click);
661+
//
556662
// ACTWebSocketMain
557663
//
558664
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
665+
this.Controls.Add(this.groupBox5);
559666
this.Controls.Add(this.groupBox4);
560667
this.Controls.Add(this.groupBox3);
561668
this.Controls.Add(this.groupBox2);
@@ -580,6 +687,8 @@ private void InitializeComponent()
580687
this.groupBox3.ResumeLayout(false);
581688
this.groupBox4.ResumeLayout(false);
582689
this.groupBox4.PerformLayout();
690+
this.groupBox5.ResumeLayout(false);
691+
this.groupBox5.PerformLayout();
583692
this.ResumeLayout(false);
584693

585694
}
@@ -986,6 +1095,11 @@ void SaveSettings()
9861095
}
9871096

9881097
private List<String> addrs = new List<String>();
1098+
String releaseTag = null;
1099+
String currentTag = null;
1100+
String currentVersionString = null;
1101+
String latestVersionString = null;
1102+
9891103
private void ACTWebSocket_Load(object sender, EventArgs e)
9901104
{
9911105
comboBoxOverlayProcType.SelectedIndex = 0;
@@ -1017,7 +1131,6 @@ private void ACTWebSocket_Load(object sender, EventArgs e)
10171131
addrs = Utility.Distinct<String>(addrs);
10181132
addrs.Sort();
10191133
core.SetAddress(addrs);
1020-
10211134
});
10221135
Task UITask = task.ContinueWith((t) =>
10231136
{
@@ -1026,10 +1139,76 @@ private void ACTWebSocket_Load(object sender, EventArgs e)
10261139
hostnames.Items.Add(addr);
10271140
}
10281141
}, TaskScheduler.FromCurrentSynchronizationContext());
1029-
1142+
VersionCheck();
10301143
CheckUpdate();
10311144
}
10321145

1146+
void VersionCheck()
1147+
{
1148+
1149+
try
1150+
{
1151+
Version version = AssemblyName.GetAssemblyName(pluginPath).Version;
1152+
currentTag = version.Major.ToString() + "." + version.Minor.ToString() + "." + version.Build.ToString();
1153+
currentVersionString = version.Major.ToString() + "." + version.Minor.ToString() + "." + version.Build.ToString() + "." + version.Revision.ToString();
1154+
currentVersion.Text = currentVersionString;
1155+
}
1156+
catch (Exception ex)
1157+
{
1158+
1159+
}
1160+
1161+
Task task2 = Task.Factory.StartNew(() =>
1162+
{
1163+
try
1164+
{
1165+
releaseTag = Utility.ReleaseTag();
1166+
}
1167+
catch (Exception ex)
1168+
{
1169+
1170+
}
1171+
});
1172+
Task UITask2 = task2.ContinueWith((t) =>
1173+
{
1174+
//develVersion.Text = latestTag + "." + develVersion;
1175+
try
1176+
{
1177+
releaseVersion.Text = releaseTag + ".0";
1178+
labelRelease.ForeColor = (releaseVersion.Text != currentVersion.Text) ? System.Drawing.Color.Red : System.Drawing.Color.Black;
1179+
}
1180+
catch (Exception ex)
1181+
{
1182+
1183+
}
1184+
}, TaskScheduler.FromCurrentSynchronizationContext());
1185+
1186+
Task task3 = Task.Factory.StartNew(() =>
1187+
{
1188+
try
1189+
{
1190+
latestVersionString = Utility.DevelVersion();
1191+
}
1192+
catch (Exception ex)
1193+
{
1194+
1195+
}
1196+
});
1197+
Task UITask3 = task3.ContinueWith((t) =>
1198+
{
1199+
//develVersion.Text = latestTag + "." + develVersion;
1200+
try
1201+
{
1202+
latestVersion.Text = latestVersionString;
1203+
labelLatest.ForeColor = (latestVersion.Text != currentVersion.Text) ? System.Drawing.Color.Red : System.Drawing.Color.Black;
1204+
}
1205+
catch (Exception ex)
1206+
{
1207+
1208+
}
1209+
}, TaskScheduler.FromCurrentSynchronizationContext());
1210+
}
1211+
10331212
private bool IsChattings(LogLineEventArgs e)
10341213
{
10351214
string[] data = e.logLine.Split('|');
@@ -1985,6 +2164,7 @@ public bool StartOverlayProc()
19852164

19862165
const uint DWM_EC_DISABLECOMPOSITION = 0;
19872166
const uint DWM_EC_ENABLECOMPOSITION = 1;
2167+
string pluginPath = null;
19882168

19892169
[DllImport("dwmapi.dll", EntryPoint = "DwmEnableComposition")]
19902170
extern static uint DwmEnableComposition(uint compositionAction);
@@ -2461,5 +2641,25 @@ private void comboBoxOverlayProcType_SelectedIndexChanged(object sender, EventAr
24612641
{
24622642
CheckUpdate();
24632643
}
2644+
2645+
private void buttonGitHub_Click(object sender, EventArgs e)
2646+
{
2647+
System.Diagnostics.Process.Start("https://github.com/ZCube/ACTWebSocket");
2648+
}
2649+
2650+
private void buttonRelease_Click(object sender, EventArgs e)
2651+
{
2652+
System.Diagnostics.Process.Start("https://github.com/ZCube/ACTWebSocket/releases");
2653+
}
2654+
2655+
private void buttonLatest_Click(object sender, EventArgs e)
2656+
{
2657+
System.Diagnostics.Process.Start("https://www.dropbox.com/s/3lrsetatf9mrmnp/ACTWebSocket_latest.7z?dl=1");
2658+
}
2659+
2660+
private void buttonVersionCheck_Click(object sender, EventArgs e)
2661+
{
2662+
VersionCheck();
2663+
}
24642664
}
24652665
}

0 commit comments

Comments
 (0)