Esempio n. 1
0
        public void Display_UDPDatagram()
        {
            var(displayer, mock) = BuildTextDisplayer();

            var udpDatagram = new UDPDatagram
            {
                Bytes = new Byte[]
                {
                    0x00, 0x44,
                    0x00, 0x43,
                    0x02, 0x2c,
                    0x00, 0x00
                }
            };

            displayer.Display(udpDatagram);

            mock.Verify(_ => _.WriteLine("udp      :                68 > 67               "), Times.Once);
        }
        /// <summary>
        /// Собирает пакет для отправки к моделирующему узлу
        /// </summary>
        /// <returns>Пакет для отправки</returns>
        private UDPDatagram CreateInfoPackage()
        {
            UDPDatagram  Result  = new UDPDatagram();
            ModelMessage Message = new ModelMessage();

            Message.Header_T = "VHost";
            Message.Header_S = DateTime.Now.ToString();

            HybridDictionary ParametersSet = new HybridDictionary();
            //HybridDictionary Entry = (HybridDictionary)GadgetsMessageQueue.Dequeue();
            uint PackageParameterCounter = 0;

            foreach (Parameter Item in Parameters)
            {
                if ((Item.Direction == ParameterDirection.output || Item.Direction == ParameterDirection.inpout) &&
                    Item.Value != null)
                {
                    ParametersSet.Add(Item.Name, Item.Value);
                    Message.Parameters   = ParametersSet;                   // TO DO ???
                    Item.LastSendingTime = DateTime.Now;
                    Item.SendingCounter++;
                    //Item.LastIPSending = remoteIP;
                    //Item.LastPortSending = remoteSendingPort;
                    PackageParameterCounter++;
                }
            }
            Result.PackageType = PackageTypes.Info;
            Result.MessageBody = Message.ToString();
            //else
            //{
            //Если сообщений нет отправляем пустой пакет Ready
            //    Result.PackageType = PackageTypes.Ready;
            //    Result.MessageBody = String.Empty;
            //}

            return(Result);
        }
Esempio n. 3
0
 public void Display(UDPDatagram udpDatagram)
 {
     NewLine($"udp      : {udpDatagram.SourcePort,17} > {udpDatagram.DestinationPort,-17}");
 }