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

Commit

Permalink
MobileProc 자동 감지 OnOff 가능.
Browse files Browse the repository at this point in the history
  • Loading branch information
ZCube committed Mar 14, 2017
1 parent 41de108 commit e2300f4
Show file tree
Hide file tree
Showing 3 changed files with 823 additions and 792 deletions.
132 changes: 65 additions & 67 deletions ACTWebSocket.Core/ACTWebSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public class ACTWebSocketMain : UserControl, IActPluginV1, PluginDirectory
private Button buttonCopyCode;
private Label label1;
private TextBox hashCode;
private CheckBox DiscoveryUse;
private CheckBox chatFilter;

public void SetSkinDir(string path)
Expand Down Expand Up @@ -145,6 +146,7 @@ private void InitializeComponent()
this.UPNPUse = new System.Windows.Forms.CheckBox();
this.randomURL = new System.Windows.Forms.CheckBox();
this.startoption = new System.Windows.Forms.GroupBox();
this.DiscoveryUse = new System.Windows.Forms.CheckBox();
this.skinOnAct = new System.Windows.Forms.CheckBox();
this.hostdata = new System.Windows.Forms.GroupBox();
this.hostnames = new System.Windows.Forms.ComboBox();
Expand Down Expand Up @@ -260,15 +262,22 @@ private void InitializeComponent()
//
// startoption
//
resources.ApplyResources(this.startoption, "startoption");
this.startoption.BackColor = System.Drawing.Color.Transparent;
this.startoption.Controls.Add(this.DiscoveryUse);
this.startoption.Controls.Add(this.skinOnAct);
this.startoption.Controls.Add(this.UPNPUse);
this.startoption.Controls.Add(this.randomURL);
this.startoption.Controls.Add(this.autostart);
resources.ApplyResources(this.startoption, "startoption");
this.startoption.Name = "startoption";
this.startoption.TabStop = false;
//
// DiscoveryUse
//
resources.ApplyResources(this.DiscoveryUse, "DiscoveryUse");
this.DiscoveryUse.Name = "DiscoveryUse";
this.DiscoveryUse.UseVisualStyleBackColor = true;
//
// skinOnAct
//
resources.ApplyResources(this.skinOnAct, "skinOnAct");
Expand All @@ -279,21 +288,21 @@ private void InitializeComponent()
//
// hostdata
//
resources.ApplyResources(this.hostdata, "hostdata");
this.hostdata.BackColor = System.Drawing.Color.Transparent;
this.hostdata.Controls.Add(this.hostnames);
this.hostdata.Controls.Add(this.label2);
this.hostdata.Controls.Add(this.uPnPPort);
this.hostdata.Controls.Add(this.label15);
this.hostdata.Controls.Add(this.label14);
this.hostdata.Controls.Add(this.port);
resources.ApplyResources(this.hostdata, "hostdata");
this.hostdata.Name = "hostdata";
this.hostdata.TabStop = false;
//
// hostnames
//
this.hostnames.FormattingEnabled = true;
resources.ApplyResources(this.hostnames, "hostnames");
this.hostnames.FormattingEnabled = true;
this.hostnames.Name = "hostnames";
this.hostnames.TextChanged += new System.EventHandler(this.hostnames_TextChanged);
//
Expand Down Expand Up @@ -323,12 +332,12 @@ private void InitializeComponent()
//
// othersets
//
resources.ApplyResources(this.othersets, "othersets");
this.othersets.BackColor = System.Drawing.Color.Transparent;
this.othersets.Controls.Add(this.chatFilter);
this.othersets.Controls.Add(this.BeforeLogLineReadUse);
this.othersets.Controls.Add(this.OnLogLineReadUse);
this.othersets.Controls.Add(this.MiniParseUse);
resources.ApplyResources(this.othersets, "othersets");
this.othersets.Name = "othersets";
this.othersets.TabStop = false;
//
Expand All @@ -342,9 +351,9 @@ private void InitializeComponent()
//
// serverStatus
//
resources.ApplyResources(this.serverStatus, "serverStatus");
this.serverStatus.Controls.Add(this.buttonOn);
this.serverStatus.Controls.Add(this.buttonOff);
resources.ApplyResources(this.serverStatus, "serverStatus");
this.serverStatus.Name = "serverStatus";
this.serverStatus.TabStop = false;
//
Expand Down Expand Up @@ -397,13 +406,13 @@ private void InitializeComponent()
//
// groupBox2
//
resources.ApplyResources(this.groupBox2, "groupBox2");
this.groupBox2.Controls.Add(this.buttonOverlay);
this.groupBox2.Controls.Add(this.buttonOpen);
this.groupBox2.Controls.Add(this.buttonURL);
this.groupBox2.Controls.Add(this.WebSkinListView);
this.groupBox2.Controls.Add(this.copyURL);
this.groupBox2.Controls.Add(this.buttonAddURL);
resources.ApplyResources(this.groupBox2, "groupBox2");
this.groupBox2.Name = "groupBox2";
this.groupBox2.TabStop = false;
//
Expand All @@ -423,12 +432,12 @@ private void InitializeComponent()
//
// groupBox1
//
resources.ApplyResources(this.groupBox1, "groupBox1");
this.groupBox1.Controls.Add(this.buttonDownload);
this.groupBox1.Controls.Add(this.buttonStartStopOverlayProc);
this.groupBox1.Controls.Add(this.buttonOpenOverlayProcManager);
this.groupBox1.Controls.Add(this.autostartoverlay);
this.groupBox1.Controls.Add(this.progressBar);
resources.ApplyResources(this.groupBox1, "groupBox1");
this.groupBox1.Name = "groupBox1";
this.groupBox1.TabStop = false;
//
Expand Down Expand Up @@ -460,8 +469,8 @@ private void InitializeComponent()
//
// groupBox3
//
this.groupBox3.Controls.Add(this.FileSkinListView);
resources.ApplyResources(this.groupBox3, "groupBox3");
this.groupBox3.Controls.Add(this.FileSkinListView);
this.groupBox3.Name = "groupBox3";
this.groupBox3.TabStop = false;
//
Expand All @@ -486,10 +495,10 @@ private void InitializeComponent()
//
// groupBox4
//
resources.ApplyResources(this.groupBox4, "groupBox4");
this.groupBox4.Controls.Add(this.buttonCopyCode);
this.groupBox4.Controls.Add(this.label1);
this.groupBox4.Controls.Add(this.hashCode);
resources.ApplyResources(this.groupBox4, "groupBox4");
this.groupBox4.Name = "groupBox4";
this.groupBox4.TabStop = false;
//
Expand All @@ -512,6 +521,7 @@ private void InitializeComponent()
//
// ACTWebSocketMain
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.groupBox4);
this.Controls.Add(this.groupBox3);
Expand All @@ -521,10 +531,10 @@ private void InitializeComponent()
this.Controls.Add(this.othersets);
this.Controls.Add(this.hostdata);
this.Controls.Add(this.startoption);
resources.ApplyResources(this, "$this");
this.Name = "ACTWebSocketMain";
this.Load += new System.EventHandler(this.ACTWebSocket_Load);
this.startoption.ResumeLayout(false);
this.startoption.PerformLayout();
this.hostdata.ResumeLayout(false);
this.hostdata.PerformLayout();
this.othersets.ResumeLayout(false);
Expand Down Expand Up @@ -684,6 +694,7 @@ public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText)
OnLogLineReadUse.Checked = OnLogLineRead;
MiniParseUse.Checked = MiniParse;
//SSLUse.Checked = UseSSL;
DiscoveryUse.Checked = UseDiscovery;
UPNPUse.Checked = UseUPnP;
randomURL.Checked = RandomURL;
skinOnAct.Checked = SkinOnAct;
Expand Down Expand Up @@ -812,6 +823,14 @@ void LoadSettings()
{
UseUPnP = false;
}
if (obj.TryGetValue("UseDiscovery", out token))
{
UseDiscovery = token.ToObject<bool>();
}
else
{
UseDiscovery = false;
}
//if (obj.TryGetValue("UseSSL", out token))
//{
// UseSSL = token.ToObject<bool>();
Expand Down Expand Up @@ -903,6 +922,7 @@ void SaveSettings()
obj.Add("Hostname", Hostname);
obj.Add("RandomURL", RandomURL);
obj.Add("UseUPnP", UseUPnP);
obj.Add("UseDiscovery", UseDiscovery);
//obj.Add("UseSSL", UseSSL);
obj.Add("AutoRun", AutoRun);
obj.Add("AutoOverlay", AutoOverlay);
Expand Down Expand Up @@ -1036,6 +1056,7 @@ public bool RandomURL

//public bool UseSSL { get; set; }
public bool UseUPnP { get; set; }
public bool UseDiscovery { get; set; }
public bool AutoRun { get; set; }
public bool AutoOverlay { get; set; }
public bool ChatFilter { get; set; }
Expand Down Expand Up @@ -1114,6 +1135,7 @@ public void StartServer()
//SSLUse.Enabled = false;
skinOnAct.Enabled = false;
UPNPUse.Enabled = false;
DiscoveryUse.Enabled = false;
randomURL.Enabled = false;
buttonOn.Enabled = false;
port.Enabled = false;
Expand All @@ -1122,80 +1144,54 @@ public void StartServer()
buttonOff.Enabled = true;


Task serviceTask = new Task(() =>
if(UseDiscovery)
{
try
Task serviceTask = new Task(() =>
{
string serviceType = "_overlay._tcp";
lock (serviceLock)
try
{
if (serviceBrowser != null)
string serviceType = "_overlay._tcp";
lock (serviceLock)
{
serviceBrowser.StopBrowse();
serviceBrowser = null;
}
if (serviceBrowser != null)
{
serviceBrowser.StopBrowse();
serviceBrowser = null;
}
{
serviceBrowser = new ServiceBrowser();
serviceBrowser.ServiceAdded += onServiceAdded;
serviceBrowser.ServiceRemoved += onServiceRemoved;
serviceBrowser.ServiceChanged += onServiceChanged;
Console.WriteLine("Browsing for type: {0}", serviceType);
serviceBrowser.StartBrowse(serviceType);
Console.ReadLine();
{
serviceBrowser = new ServiceBrowser();
serviceBrowser.ServiceAdded += onServiceAdded;
serviceBrowser.ServiceRemoved += onServiceRemoved;
serviceBrowser.ServiceChanged += onServiceChanged;
Console.WriteLine("Browsing for type: {0}", serviceType);
serviceBrowser.StartBrowse(serviceType);
Console.ReadLine();
}
}
}
String url = ("http") + "://" + Hostname + ":" + Port + "/";
if (ACTWebSocketCore.randomDir != null)
{
url += ACTWebSocketCore.randomDir + "/";
}
string address = string.Format("http://zcube.kr:8585/shorten?longUrl={0}", Uri.EscapeDataString(url));
HttpWebRequest request = HttpWebRequest.CreateHttp(address);
WebResponse response = request.GetResponse();
String res = "";
using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
{
res = reader.ReadToEnd();
}
res = res;
JObject obj = JObject.Parse(res);
JToken token;
int status_code = 0;
String hash = "";
if (obj.TryGetValue("status_code", out token))
catch (Exception e)
{
status_code = token.ToObject<int>();
}
JObject data = (JObject)obj["data"];
if (data != null && data.TryGetValue("hash", out token))
{
hash = token.ToObject<String>();
}
hashCode.Text = hash;
}
catch (Exception e)
{
}
});
serviceTask.Start();
});
serviceTask.Start();
}
}

public void StopServer()
{
if (serviceBrowser != null)
if(UseDiscovery)
{
lock (serviceLock)
if (serviceBrowser != null)
{
serviceBrowser.StopBrowse();
serviceBrowser = null;
lock (serviceLock)
{
serviceBrowser.StopBrowse();
serviceBrowser = null;
}
}
}
core.StopServer();
Expand All @@ -1206,6 +1202,7 @@ public void StopServer()
//SSLUse.Enabled = true;
skinOnAct.Enabled = true;
UPNPUse.Enabled = true;
DiscoveryUse.Enabled = true;
randomURL.Enabled = true;
buttonOn.Enabled = true;
port.Enabled = true;
Expand Down Expand Up @@ -1389,6 +1386,7 @@ private void UpdateFormSettings()
MiniParse = MiniParseUse.Checked;
//UseSSL = SSLUse.Checked;
UseUPnP = UPNPUse.Checked;
UseDiscovery = DiscoveryUse.Checked;
RandomURL = randomURL.Checked;
SkinOnAct = skinOnAct.Checked;
ChatFilter = chatFilter.Checked;
Expand Down
28 changes: 17 additions & 11 deletions ACTWebSocket.Core/ACTWebSocket.ko.resx
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,22 @@
<data name="randomURL.Text" xml:space="preserve">
<value>임의의 URL 사용</value>
</data>
<data name="skinOnAct.Text" xml:space="preserve">
<value>스킨 경로 Act/OverlaySkin 사용</value>
</data>
<data name="startoption.Text" xml:space="preserve">
<value>시작 옵션</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="DiscoveryUse.Size" type="System.Drawing.Size, System.Drawing">
<value>144, 16</value>
</data>
<data name="DiscoveryUse.Text" xml:space="preserve">
<value>MobileProc 자동 감지</value>
</data>
<data name="skinOnAct.Text" xml:space="preserve">
<value>스킨 경로 Act/OverlaySkin 사용</value>
</data>
<data name="hostdata.Text" xml:space="preserve">
<value>서버</value>
</data>
<data name="label2.Size" type="System.Drawing.Size, System.Drawing">
<value>66, 12</value>
</data>
Expand All @@ -170,15 +179,12 @@
<data name="label14.Text" xml:space="preserve">
<value>포트</value>
</data>
<data name="hostdata.Text" xml:space="preserve">
<value>서버</value>
<data name="othersets.Text" xml:space="preserve">
<value>메세지 필터</value>
</data>
<data name="chatFilter.Text" xml:space="preserve">
<value>채팅 내용 전달</value>
</data>
<data name="othersets.Text" xml:space="preserve">
<value>메세지 필터</value>
</data>
<data name="serverStatus.Text" xml:space="preserve">
<value>서버 상태</value>
</data>
Expand All @@ -194,12 +200,12 @@
<data name="buttonOpen.Text" xml:space="preserve">
<value>URL 열기</value>
</data>
<data name="buttonOverlay.Text" xml:space="preserve">
<value>오버레이</value>
</data>
<data name="groupBox2.Text" xml:space="preserve">
<value>웹 스킨</value>
</data>
<data name="buttonOverlay.Text" xml:space="preserve">
<value>오버레이</value>
</data>
<data name="autostartoverlay.Text" xml:space="preserve">
<value>오버레이 자동 시작/종료</value>
</data>
Expand Down
Loading

0 comments on commit e2300f4

Please sign in to comment.