static void Main(string[] args) { ToolsIOUtils.Init(); Console.Write("开启商品工具"); Application.EnableVisualStyles(); Application.ApplicationExit += new EventHandler(Application_ApplicationExit); Application.SetCompatibleTextRenderingDefault(false); Application.Run(); }
public static void Init() { JavaScriptSerializer serializer = JavaScriptSerializer.CreateInstance(); socket.On(Socket.EVENT_CONNECT, () => { Data data = new Data("tools"); data.comefrom = "net"; socket.Emit("login", serializer.Serialize(data)); }); socket.On("getGoodMsg", (data) => { Console.Write(string.Format("接入查询数据,{0}", data)); HashObject hash = serializer.Deserialize <HashObject>(data.ToString()); HashObject hashData = serializer.Deserialize <HashObject>(hash.GetValue <string>("msg")); SendMsg msg = new SendMsg("tools"); msg.comefrom = "net"; msg.touid = hashData.GetValue <string>("fid"); try { MilitaryInvestigationTool military = new MilitaryInvestigationTool(); string condition = hashData.GetValue <string>("url"); if (condition.StartsWith("wwid=")) { military.GetGoodMsg(condition, (obj) => { msg.msg = serializer.Serialize(obj); var imsg = serializer.Serialize(msg); Console.Write(string.Format("输出数据,{0}", imsg)); ToolsIOUtils.Emit("goodMsg", imsg); }); return; } msg.msg = serializer.Serialize(military.GetSingleGoodMsg(condition)); } catch (Exception e1) { msg.msg = e1.Message; } var tmsg = serializer.Serialize(msg); Console.Write(string.Format("输出数据,{0}", tmsg)); ToolsIOUtils.Emit("goodMsg", tmsg); }); }