public void HandleReceivedData(object sender, string s) { mtx.WaitOne(); Profile cleanprofile = new Profile(); try { cleanprofile = packer.Unpack(s); if (cleanprofile.AppName == "LAST") { Print(_allProfiles, new ConsolePrinter(), new ConsoleFormatter()); } else { _allProfiles.Add(cleanprofile); } } catch (Exception) { Console.WriteLine("Error in decrypting data.."); } mtx.ReleaseMutex(); }
/// <summary> /// 当收到消息的时候 /// </summary> /// <param name="message">最终需要的东西</param> void OnReceive(byte[] bytes) { IMessage message = packer.Unpack(bytes); //TODO 分发消息 }