Resert changes

This commit is contained in:
qianlifeng 2014-03-01 11:49:53 +08:00
parent 8c86ae2461
commit 1dde832e31

View File

@ -1,10 +1,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
@ -59,41 +56,8 @@ namespace Wox
{
SetTheme(CommonStorage.Instance.UserSetting.Theme = "Default");
}
new Thread(Listen).Start();
}
private void Listen()
{
try
{
TcpListener tcpl = new TcpListener(new IPEndPoint(IPAddress.Parse("127.0.0.1"),1234));//在5656端口新建一个TcpListener对象
tcpl.Start();
Debug.WriteLine("started listening..");
while (true)
{
Socket s = tcpl.AcceptSocket();
string remote = s.RemoteEndPoint.ToString();
Byte[] stream = new Byte[80];
int i = s.Receive(stream);
string msg = "<" + remote + ">" + System.Text.Encoding.UTF8.GetString(stream);
Debug.WriteLine(msg);
}
}
catch (System.Security.SecurityException)
{
Debug.WriteLine("firewall says no no to application - application cries..");
}
catch (Exception)
{
Debug.WriteLine("stoped listening..");
}
}
public void SetHotkey(string hotkeyStr, EventHandler<HotkeyEventArgs> action)
{
var hotkey = new HotkeyModel(hotkeyStr);