Ejemplo n.º 1
0
 public DnmpClient(MessageInterface messageInterface, Protocol usedProtocol, ClientConfig config)
 {
     Config           = config;
     MessageInterface = messageInterface;
     MessageHandler   = new MessageHandler(this);
     NetworkHandler   = new NetworkHandler(this, usedProtocol);
 }
Ejemplo n.º 2
0
 public async Task StartAsFirstNodeAsync(IEndPoint sourceEndPoint, IEndPoint publicEndPoint, IAsymmetricKey key, ISymmetricKey dummySymmetricKey, byte[] selfCustomData)
 {
     if (CurrentStatus != ClientStatus.NotConnected)
     {
         return;
     }
     if (selfCustomData.Length > 65000) //TODO
     {
         throw new DnmpException("Custom data length is larger than 65000 bytes");
     }
     SelfCustomData = selfCustomData;
     SelfClient     = new DnmpNode
     {
         Id         = 0,
         EndPoint   = publicEndPoint,
         CustomData = SelfCustomData
     };
     Initialize(sourceEndPoint, key, dummySymmetricKey);
     CurrentStatus = ClientStatus.Connected;
     logger.Info($"Started as first node on {sourceEndPoint} [{publicEndPoint}]");
     OnClientConnected?.Invoke(SelfClient.Id);
     OnConnected?.Invoke();
     MessageInterface.Initialize(SelfClient.Id);
     await Task.Delay(0);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Interprests data received from the server.
 /// </summary>
 /// <param name="cl">Server connection object.</param>
 public void ReceiveData(TcpClient cl)
 {
     try
     {
         byte[] receivedBytes = new byte[1024];
         int    byte_count;
         while ((byte_count = clientNS.Read(receivedBytes, 0, receivedBytes.Length)) > 0)
         {
             string msg = Encoding.ASCII.GetString(receivedBytes, 0, byte_count);
             //NetworkCommand nc = JsonConvert.DeserializeObject<NetworkCommand>(msg);
             MessageInterface mi = JsonConvert.DeserializeObject <MessageInterface>(msg);
             RunCommandSimSide(mi);
         }
     }
     catch (ObjectDisposedException)
     {
         EntryOutput(">> Connection closed, error caught.");
         CloseConnection();
     }
     catch (IOException)
     {
         EntryOutput(">> Connection closed: Server shut down or lost network connectivity.");
         CloseConnection();
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        ///  执行中 的短信
        /// </summary>
        /// <param name="tel"></param>
        /// <param name="dics"></param>
        /// <returns></returns>
        public bool Doing(string no)
        {
            try
            {
                var order = DalContext.Repository <Order>().TableNoTracking.Where(o => o.BillNo == no).FirstOrDefault();
                if (order.OrderState < OrderStateEnum.执行中 || order.OrderState >= OrderStateEnum.务结束)
                {
                    return(false);
                }

                var orderAddr   = DalContext.Repository <OrderAddr>().TableNoTracking.Where(o => o.BillNo == no).FirstOrDefault();
                var orderWaiter = DalContext.Repository <OrderWaiter>().TableNoTracking.Where(o => o.BillNo == no).OrderByDescending(o => o.IsLeader).FirstOrDefault();


                if (IsTel(orderAddr.Tel))
                {
                    Dictionary <string, string> dics = new Dictionary <string, string>();
                    dics.Add("StartTime", no);
                    dics.Add("ProductName", order.ProductName);
                    dics.Add("ServiceNo", orderWaiter.ServiceName);
                    return(MessageInterface.SmsSend(orderAddr.Tel, "执行中", dics));
                }
            }
            catch (Exception exc)
            {
                NLogger.Error($"订单{no}'执行中'短信发送失败, {exc.Message}");
            }
            return(false);
        }
Ejemplo n.º 5
0
        public int SendVerifyCodeSMS(string phone, out string error)
        {
            error = "";


            // 短信接口
            MessageInterface external_interface = this.GetMessageInterface("sms");

            // 短信模板
            string strMessageTemplate = "验证码为 %verifycode%。一小时内有效。";


            string strVerifyCode = "";
            string strBody       = strMessageTemplate.Replace("%verifycode%", strVerifyCode);
            int    nRet          = 0;

            // 向手机号码发送短信
            {
                // 得到高级xml
                string strXml = "<root><tel>" + phone + "</tel></root>";
                // 发送消息
                try
                {
                    // 发送一条消息
                    // parameters:
                    //      strPatronBarcode    读者证条码号
                    //      strPatronXml    读者记录XML字符串。如果需要除证条码号以外的某些字段来确定消息发送地址,可以从XML记录中取
                    //      strMessageText  消息文字
                    //      strError    [out]返回错误字符串
                    // return:
                    //      -1  发送失败
                    //      0   没有必要发送
                    //      >=1   发送成功,返回实际发送的消息条数
                    nRet = external_interface.HostObj.SendMessage(
                        "", //strBarcode
                        strXml,
                        strBody,
                        "",//lib.libName, //todo,注意这里原来传的code 还是读者的libraryCode
                        out error);
                    if (nRet == -1 || nRet == 0)
                    {
                        return(nRet);
                    }
                }
                catch (Exception ex)
                {
                    error = external_interface.Type + " 类型的外部消息接口Assembly中SendMessage()函数抛出异常: " + ex.Message;
                    nRet  = -1;
                }
                if (nRet == -1)
                {
                    error = "向" + phone + "发送" + external_interface.Type + " message时出错:" + error;

                    this.WriteErrorLog(error);
                    return(-1);
                }
            }

            return(0);
        }
Ejemplo n.º 6
0
 public ChatApiController()
 {
     userService        = new UserRepository();
     chatService        = new ChatRepository();
     messageService     = new MessageRepository();
     chatRequestService = new ChatRequestRepository();
     this.eventService  = new EventService();
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Interprets the received NetworkCommand message.
        /// </summary>
        /// <param name="data">Deserialized NetworkCommand message.</param>
        /// <param name="id">ClientID of client sending message.</param>
        public void ReceiveSimMessage(string data, int id)
        {
            TcpClient        client = list_clients[id];
            MessageInterface mi     = JsonConvert.DeserializeObject <MessageInterface>(data);

            switch (mi.Type)
            {
            case "AuthRequest":
                // Request connection to server
                break;

            case "WhoIs":
                WhoIs wi = (WhoIs)mi;
                if (connected_clients.ContainsKey(wi.MACAddress))
                {
                    connected_clients.Remove(wi.MACAddress);
                }
                connected_clients.Add(wi.MACAddress, new ClientConnections(wi.IPAddress, wi.MACAddress, id));
                Thread stillAliveThread = new Thread(() => StillAlive(client, wi.MACAddress));
                stillAliveThread.Start();
                break;

            case "KillKey":
                KillKey k = (KillKey)mi;
                OnClientConnect(new ClientConnectEventArgs(2, k.IPAddress, k.MACAddress));
                ClientDisconnects(connected_clients[k.MACAddress].DictionaryID, k.MACAddress);
                break;

            default:
                CmdAdmin.ReceiveCommand(mi);
                break;
            }

            /*NetworkCommand nc = JsonConvert.DeserializeObject<NetworkCommand>(data);
             * switch (nc.Type)
             * {
             *  case NetworkCommand.CommandTypes.AuthRequest:
             *      // Request connection to the server
             *      break;
             *  case NetworkCommand.CommandTypes.WhoIs:
             *      if (connected_clients.ContainsKey(nc.MacAddress))
             *      {
             *          connected_clients.Remove(nc.MacAddress);
             *      }
             *      connected_clients.Add(nc.MacAddress, new ClientConnections(nc.IpAddress, nc.MacAddress, id));
             *      Thread stillAliveThread = new Thread(() => StillAlive(client, nc.MacAddress));
             *      stillAliveThread.Start();
             *      break;
             *  case NetworkCommand.CommandTypes.KillKey:
             *      OnClientConnect(new ClientConnectEventArgs(2, "", nc.MacAddress));
             *      ClientDisconnects(connected_clients[nc.MacAddress].DictionaryID, nc.MacAddress);
             *      break;
             *  default:
             *      CmdAdmin.ReceiveCommand(nc);
             *      break;
             * }*/
        }
Ejemplo n.º 8
0
        /*public void ReceiveCommand(NetworkCommand nc)
         * {
         *  switch(nc.Type)
         *  {
         *      case NetworkCommand.CommandTypes.GameRunningUpdate:
         *          //OnSimUpdateEvent(new SimUpdateEventArgs(cmd[1], cmd[2]));
         *          // nc.Message = gameName
         *          // nc.Value = start/end
         *          OnSimUpdateEvent(new SimUpdateEventArgs(nc.MacAddress, nc.Message));
         *          break;
         *  }
         * }*/

        public void ReceiveCommand(MessageInterface m)
        {
            switch (m.Type)
            {
            case "GameRunningUpdate":
                GameRunningUpdate gru = (GameRunningUpdate)m;
                OnSimUpdateEvent(new SimUpdateEventArgs(gru.MACAddress, gru.GameName));
                break;
            }
        }
    public void Setup(MessageInterface mi, TutorialArrowInterface tai)
    {
        message.ResetTimesShown();

        canShow                = true;
        messageInterface       = mi;
        tutorialArrowInterface = tai;

        if (hasShowEvent)
        {
            showEvent.AddListener(Show, true);
        }
    }
Ejemplo n.º 10
0
    public override void Update()
    {
        base.Update();

        while (MessageInterface.HasMessageInQueue)
        {
            var msg = MessageInterface.PopFromQueue();
            if (msg is PlayerDeathMessage)
            {
                EndLevel("GameOverScene", false);
            }
        }
    }
Ejemplo n.º 11
0
        /*public void ReceiveCommand(NetworkCommand nc)
         * {
         *  switch(nc.Type)
         *  {
         *      case NetworkCommand.CommandTypes.KillKey:
         *          // Disconnects client from server
         *          nt.CloseConnection();
         *          break;
         *      case NetworkCommand.CommandTypes.StartTime:
         *          // Starts time and session
         *          // nc.Message = time   nc.Value = buffer
         *          StartTimeCmd(nc.Message, nc.Value);
         *          break;
         *      case NetworkCommand.CommandTypes.PauseTime:
         *          // Pauses session
         *          // nc.Message = time
         *          PauseTimeCmd(nc.Message);
         *          break;
         *      case NetworkCommand.CommandTypes.StopTime:
         *          // Stops session
         *          nt.Sim.TM.StopTime();
         *          break;
         *      case NetworkCommand.CommandTypes.KeepAlive:
         *          // Restarts KeepAlive thread on client side
         *          nt.RestartKeepAliveThread();
         *          break;
         *      case NetworkCommand.CommandTypes.SimBookingInfoUpdate:
         *          // Updates booking info with next scheduled session
         *          // 1 = mac, 2 = next reservation name, 3 = next reservation time, 4 = start time (long), 5 = force update (bool)
         *          // nc.Message = split string of above values
         *          // 0 = nextReservationName, 1 = nextReservationTime, 2 = startTime (long), 3 = forceUpdate (bool)
         *          string[] msg = nc.Message.Split('~');
         *          OnNextBookingUpdateEvent(new NextBookingUpdatedEventArgs(nc.MacAddress, msg[0], msg[1], long.Parse(msg[2]), bool.Parse(msg[3])));
         *          break;
         *      case NetworkCommand.CommandTypes.SimInfoUpdate:
         *          // Updates sim nickname and/or model
         *          // nc.Message = nickname   nc.Value = model
         *          OnSimInfoUpdateEvent(new SimInfoUpdateEventArgs(nc.Message, nc.Value));
         *          break;
         *      default:
         *          // Catch-all
         *          break;
         *  }
         * }*/

        public void ReceiveCommand(MessageInterface m)
        {
            switch (m.Type)
            {
            case "KillKey":
                nt.CloseConnection();
                break;

            case "TimeCommand":
                TimeCommand tc = (TimeCommand)m;
                switch (tc.SubType)
                {
                case "StartTime":
                    StartTimeCmd(tc.Time, tc.Buffer);
                    break;

                case "PauseTime":
                    PauseTimeCmd(tc.Time);
                    break;

                case "StopTime":
                    nt.Sim.TM.StopTime();
                    break;
                }
                break;

            case "Ping":
                nt.RestartKeepAliveThread();
                break;

            case "BookingInfoUpdate":
                BookingInfoUpdate biu = (BookingInfoUpdate)m;
                OnNextBookingUpdateEvent(new NextBookingUpdatedEventArgs("mac", biu.DisplayName, biu.Time, biu.StartTime, biu.ForceUpdate));
                break;

            case "SimInfoUpdate":
                SimInfoUpdate siu = (SimInfoUpdate)m;
                OnSimInfoUpdateEvent(new SimInfoUpdateEventArgs(siu.NickName, siu.Model));
                break;

            default:
                // catch-all
                break;
            }
        }
Ejemplo n.º 12
0
 /// <summary>
 /// 开始服务
 /// </summary>
 /// <param name="tel"></param>
 /// <param name="dics"></param>
 /// <returns></returns>
 public bool StartServic(string no)
 {
     try
     {
         var order     = DalContext.Repository <Order>().TableNoTracking.Where(o => o.BillNo == no).FirstOrDefault();
         var orderAddr = DalContext.Repository <OrderAddr>().TableNoTracking.Where(o => o.BillNo == no).FirstOrDefault();
         if (IsTel(orderAddr.Tel))
         {
             Dictionary <string, string> dics = new Dictionary <string, string>();
             dics.Add("ServerItemCode", no);
             dics.Add("RealStarTime", order.RealStartTime.ToString());
             return(MessageInterface.SmsSend(orderAddr.Tel, "开始服务", dics));
         }
     }
     catch (Exception exc)
     {
         NLogger.Error($"订单{no}'开始服务'短信发送失败, {exc.Message}");
     }
     return(false);
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Triggered when a beacon is found on the network. Begins the connection process.
        /// </summary>
        /// <param name="ar">AsyncResult from the beacon being triggered.</param>
        private void BeaconFound(IAsyncResult ar)
        {
            if (!CheckRunBeacon)
            {
                try
                {
                    IPEndPoint endpoint = new IPEndPoint(IPAddress.Any, commPort);
                    byte[]     bytes    = beaconUDP.EndReceive(ar, ref endpoint);
                    string     msg      = Encoding.ASCII.GetString(bytes);
                    //NetworkCommand nc = JsonConvert.DeserializeObject<NetworkCommand>(msg);
                    MessageInterface mi = JsonConvert.DeserializeObject <MessageInterface>(msg);
                    if (mi.Type == "CommSystem")
                    {
                        CommSystem cs = (CommSystem)mi;
                        beaconIP = cs.IPAddress;
                        ConnectToServer(beaconIP);
                    }

                    /*if(nc.Type == NetworkCommand.CommandTypes.CommSystem)
                     * {
                     *  beaconIP = nc.IpAddress;
                     *  ConnectToServer(beaconIP);
                     * }*/
                }
                catch (ObjectDisposedException)
                {
                    EntryOutput("Error 2");
                }
                catch (NullReferenceException)
                {
                    EntryOutput("Error 3");
                }
                catch (ArgumentException)
                {
                    EntryOutput("Error 4");
                }
            }
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Handles an incoming socket message from Discord.
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="e">The arguments of the socket message.</param>
 public static void HandleSocketMessage(object sender, MessageEventArgs e)
 {
     if (e.IsText)
     {
         resp = JsonConvert.DeserializeObject <RemPayload>(e.Data);
         var respd = JsonConvert.DeserializeObject <Dictionary <string, object> >(JsonConvert.SerializeObject(resp.d));
         hb_seq = resp.s;
         if (resp.op == (int)OpCodes.Hello && HaveRecievedHello == false)
         {
             int.TryParse((respd.First(x => x.Key == "heartbeat_interval").Value).ToString(), out result);
             HeartbeatTimer.Interval = result;
             HeartbeatTimer.Enabled  = true;
             HaveRecievedHello       = true;
             if (VerboseMode)
             {
                 NepLogger.Log("Recieved Hello payload. Heartbeat interval: " + result, "Setup");
             }
         }
         if (resp.op == (int)OpCodes.HeartbeatACK && VerboseMode)
         {
             NepLogger.Log("Recieved Heartbeat acknowledgement.", "Heartbeat");
         }
         if (!(resp.op == (int)OpCodes.Dispatch) && !(resp.op == (int)OpCodes.HeartbeatACK) && !(resp.op == (int)OpCodes.Hello) && VerboseMode)
         {
             NepLogger.Log($"Recieved message from Discord with OP Code {resp.op} ({OpCodeDetails[(OpCodes)resp.op]}), and data {resp.d}");
         }
         if (resp.op == (int)OpCodes.Dispatch && resp.t == "MESSAGE_CREATE")
         {
             //messagecreate
             var message = JsonConvert.DeserializeObject <DiscordUserMessage>(JsonConvert.SerializeObject(resp.d));
             if (message.Content == ".remcord")
             {
                 StringBuilder sb = new StringBuilder();
                 sb.AppendLine("**== Remcord - a Discord API for .NET ==**");
                 sb.AppendLine("Remcord is an upcoming alpha API and bot platform for .NET.");
                 sb.AppendLine("Current version: 0.12 *Drunk Elephant*");
                 sb.AppendLine("Build info: " + GetBuildInfo());
                 sb.AppendLine("Current gateway version: **Gateway v5**");
                 sb.AppendLine("Using WSS or WSX? **WSS**");
                 sb.AppendLine("Using:");
                 sb.AppendLine("**WebSocketSharp** as the WebSocket library. [Regrets!]");
                 sb.AppendLine("**RestSharp** for REST communication with Discord. [More regrets]");
                 MessageInterface.SendMessage(sb.ToString(), message.ChannelID);
             }
             if (message.Content == ".socket")
             {
                 StringBuilder sb = new StringBuilder();
                 sb.AppendLine("**Remcord Socket Information**");
                 sb.AppendLine("Currently using **WebSocketSharp** as our WebSocket library.");
                 sb.AppendLine("Connected to Discord gateway " + ConnectionManager.GetGateway().url);
                 sb.AppendLine("Internal gateway " + ConnectionManager.GetGateway());
                 sb.AppendLine("Remcord version: 0.12");
                 var time = DateTime.Now.Subtract(LastHeartbeatTime).Seconds;
                 if (SentFirstHeartbeat)
                 {
                     sb.AppendLine($"The last heartbeat was sent " + time + $" {(time == 1 ? "second" : "seconds")} ago.");
                 }
                 MessageInterface.SendMessage(sb.ToString(), message.ChannelID);
             }
             if (message.Content.Contains(".rr ") || message.Content.Contains(".russianroulette "))
             {
                 Random gen  = new Random();
                 var    args = message.Content.Split(' ')[1];
                 int    ndx;
                 if (int.TryParse(args, out ndx))
                 {
                     MessageInterface.SendMessage(gen.Next(1, ndx) == 1 ? ":skull_crossbones: You have died!" : ":sunny: You are alive.", message.ChannelID);
                 }
                 else
                 {
                     MessageInterface.SendMessage("invalid argument", message.ChannelID);
                 }
             }
             if (message.Content == ".rr" || message.Content == ".russianroulette")
             {
                 Random gen = new Random();
                 int    nx  = gen.Next(1, 6);
                 MessageInterface.SendMessage((nx == 1 ? ":skull_crossbones: You have died!" : ":sunny: You are alive."), message.ChannelID);
             }
         }
         else if (resp.op == (int)OpCodes.Dispatch && VerboseMode)
         {
             NepLogger.Log((resp.t).ToTitleCase().Replace('_', ' '), "Incoming Event");
         }
     }
     else
     {
         NepLogger.Log(e.RawData + e.Data, "Unknown Event Data");
     }
 }
Ejemplo n.º 15
0
 public void removeMessageInterface(MessageInterface msgInterface)
 {
     channelListenersMap.Remove(msgInterface.getId());
 }
Ejemplo n.º 16
0
 public void putMessageInterface(MessageInterface msgInterface)
 {
     channelListenersMap.Add(msgInterface.getId(), msgInterface);
 }
Ejemplo n.º 17
0
        // 发送短信验证码
        public int SendVerifyCodeSMS(string phone,
                                     string code,
                                     out string error)
        {
            error = "";
            int nRet = 0;


            // 短信接口
            if (this.m_externalMessageInterfaces == null)
            {
                error = "m_externalMessageInterfaces为null。";
                goto ERROR1;
            }
            MessageInterface external_interface = this.GetMessageInterface("sms");

            if (external_interface == null)
            {
                error = "未找到短信接口对象。";
                goto ERROR1;
            }

            // 短信模板
            string strMessageTemplate = "Z39.50站点提交验证码为 %verifycode%。";
            string strBody            = strMessageTemplate.Replace("%verifycode%", code);

            // 向手机号码发送短信
            string strXml = "<root><tel>" + phone + "</tel></root>";

            try
            {
                // 发送一条消息
                // parameters:
                //      strPatronBarcode    读者证条码号
                //      strPatronXml    读者记录XML字符串。如果需要除证条码号以外的某些字段来确定消息发送地址,可以从XML记录中取
                //      strMessageText  消息文字
                //      strError    [out]返回错误字符串
                // return:
                //      -1  发送失败
                //      0   没有必要发送
                //      >=1   发送成功,返回实际发送的消息条数
                nRet = external_interface.HostObj.SendMessage(
                    "",
                    strXml,
                    strBody,
                    "",//strLibraryCode
                    out error);
                if (nRet == -1 || nRet == 0)
                {
                    return(nRet);
                }
            }
            catch (Exception ex)
            {
                error = external_interface.Type + " 类型的外部消息接口Assembly中SendMessage()函数抛出异常: " + ex.Message;
                goto ERROR1;
            }

            return(0);

ERROR1:

            error = "向" + phone + "发送短信时出错:" + error;
            this.WriteErrorLog(error);
            return(-1);
        }
Ejemplo n.º 18
0
        // 初始化扩展的消息接口

        /*
         * <externalMessageInterface>
         * <interface type="sms" assemblyName="chchdxmessageinterface"/>
         * </externalMessageInterface>
         */
        // parameters:
        // return:
        //      -1  出错
        //      0   当前没有配置任何扩展消息接口
        //      1   成功初始化
        public int InitialExternalMessageInterfaces(XmlDocument dom, out string strError)
        {
            strError = "";

            m_externalMessageInterfaces = null;
            XmlNode root = dom.DocumentElement.SelectSingleNode("externalMessageInterface");

            if (root == null)
            {
                strError = "在weixin.xml中没有找到<externalMessageInterface>元素";
                return(-1);
            }

            m_externalMessageInterfaces = new List <MessageInterface>();

            XmlNodeList nodes = root.SelectNodes("interface");

            foreach (XmlNode node in nodes)
            {
                string strType = DomUtil.GetAttr(node, "type");
                if (String.IsNullOrEmpty(strType) == true)
                {
                    strError = "<interface>元素未配置type属性值";
                    return(-1);
                }

                string strAssemblyName = DomUtil.GetAttr(node, "assemblyName");
                if (String.IsNullOrEmpty(strAssemblyName) == true)
                {
                    strError = "<interface>元素未配置assemblyName属性值";
                    return(-1);
                }

                MessageInterface message_interface = new MessageInterface();
                message_interface.Type     = strType;
                message_interface.Assembly = Assembly.Load(strAssemblyName);
                if (message_interface.Assembly == null)
                {
                    strError = "名字为 '" + strAssemblyName + "' 的Assembly加载失败...";
                    return(-1);
                }

                Type hostEntryClassType = ScriptManager.GetDerivedClassType(
                    message_interface.Assembly,
                    "DigitalPlatform.Interfaces.ExternalMessageHost");
                if (hostEntryClassType == null)
                {
                    strError = "名字为 '" + strAssemblyName + "' 的Assembly中未找到 DigitalPlatform.Interfaces.ExternalMessageHost类的派生类,初始化扩展消息接口失败...";
                    return(-1);
                }

                message_interface.HostObj = (ExternalMessageHost)hostEntryClassType.InvokeMember(null,
                                                                                                 BindingFlags.DeclaredOnly |
                                                                                                 BindingFlags.Public | BindingFlags.NonPublic |
                                                                                                 BindingFlags.Instance | BindingFlags.CreateInstance, null, null,
                                                                                                 null);
                if (message_interface.HostObj == null)
                {
                    strError = "创建 type 为 '" + strType + "' 的 DigitalPlatform.Interfaces.ExternalMessageHost 类的派生类的对象(构造函数)失败,初始化扩展消息接口失败...";
                    return(-1);
                }

                message_interface.HostObj.App = this;    //如果全部成功是static,这里好像有问题

                this.m_externalMessageInterfaces.Add(message_interface);
            }

            return(0);
        }
Ejemplo n.º 19
0
 public void display(MessageInterface message)
 {
     Console.WriteLine(message.getMessage());
 }
Ejemplo n.º 20
0
 public Consumer(string exchange, string exchangeType) : base(exchange, exchangeType)
 {
     this.exchange  = exchange;
     eventService   = new EventService();
     messageService = new MessageRepository();
 }
Ejemplo n.º 21
0
        /// <summary>
        /// Interprets the command message received.
        /// </summary>
        /// <param name="mi">Command message received</param>

        /*private void RunCommandSimSide(NetworkCommand nc)
         * {
         *  Cmd.ReceiveCommand(nc);
         * }*/
        private void RunCommandSimSide(MessageInterface mi)
        {
            Cmd.ReceiveCommand(mi);
        }
Ejemplo n.º 22
0
 public DnmpClient(MessageInterface messageInterface) : this(messageInterface, new UdpProtocol(), new ClientConfig())
 {
 }
Ejemplo n.º 23
0
 public virtual bool Equal(MessageInterface <T> other)
 {
     throw new NotImplementedException();
 }