Exemplo n.º 1
0
 public override void Update(Notifications notifica)
 {
     //update about the Notifications
     Received.Add(notifica);
     Program.database.listofstudent[this.id - 1] = this;
     sync();
 }
Exemplo n.º 2
0
        public override void Update(Notifications notifica)
        {
            Received.Add(notifica);
            Program.database.listofadvisor[this.id - 1] = this;

            sync();
        }
Exemplo n.º 3
0
    protected override void AddColour(CharacterColour colour)
    {
        if (IsComplete)
        {
            return;
        }

        Received.Add(colour);

        // If we have the correct number of elements in buffer then check combination
        if (Received.Count == combination.Length)
        {
            for (int i = 0; i < combination.Length; i++)
            {
                // Incorrect combination
                if (Received[i] != combination[i])
                {
                    // Clear the received buffer
                    Received.Clear();
                    // Play a failure sound?
                    return;
                }
            }

            // Combination was correct
            SetComplete();
        }
    }
Exemplo n.º 4
0
 public void Update(object sender, UpdateEventArgs args)
 {
     using (_lock.Acquire())
     {
         for (int i = 0; i < args.NewEvents.Length; i++)
         {
             Received.Add(args.NewEvents[i].Underlying);
         }
     }
 }
Exemplo n.º 5
0
 public void Receive(int numberOfMessages)
 {
     for (int i = 0; i < numberOfMessages; i++)
     {
         using (var frame = _socket.ReceiveFrame())
         {
             var message = frame.ReadString();
             Received.Add(message);
         }
     }
 }
        private void HandleData(byte[] data)
        {
            if (data != null)
            {
                using (PacketDataReader reader = new ProtobufDataReader(data))
                {
                    var id = reader.Read <VarInt>();

                    if (SCONPacketResponses.Packets.Length > id)
                    {
                        if (SCONPacketResponses.Packets[id] != null)
                        {
                            var packet = SCONPacketResponses.Packets[id]().ReadPacket(reader) as SCONPacket;
                            if (packet != null)
                            {
                                HandlePacket(packet);

#if DEBUG
                                Received.Add(packet);
#endif
                            }
                            else
                            {
                                Core.Logger.Log($"SCON Reading Error: packet is null. Packet ID {id}"); // TODO: Disconnect?
                            }
                        }
                        else
                        {
                            Core.Logger.Log($"SCON Reading Error: SCONPacketResponses.Packets[{id}] is null.");
                        }
                    }
                    else
                    {
                        Core.Logger.Log($"SCON Reading Error: Packet ID {id} is not correct, Packet Data: {data}. Disconnecting.");
                        Module.RemoveClient(this, $"Packet ID {id} is not correct!");
                    }
                }
            }
            else
            {
                Core.Logger.Log($"SCON Reading Error: Packet Data is null.");
            }
        }
Exemplo n.º 7
0
 public void Update(Object sender, UnmatchedEventArgs unmatchedEventArgs)
 {
     Received.Add(unmatchedEventArgs.Event);
     _engine.EPAdministrator.CreateEPL("select * from SupportBean");
 }
Exemplo n.º 8
0
 public void Update(Object sender, UnmatchedEventArgs unmatchedEventArgs)
 {
     Received.Add(unmatchedEventArgs.Event);
 }
Exemplo n.º 9
0
        /// <summary>
        /// Parses a single header and sets member variables according to it.
        /// </summary>
        /// <param name="headerName">The name of the header</param>
        /// <param name="headerValue">The value of the header in unfolded state (only one line)</param>
        /// <exception cref="ArgumentNullException">If <paramref name="headerName"/> or <paramref name="headerValue"/> is <see langword="null"/></exception>
        public void ParseHeader(String headerName, String headerValue)
        {
            if (headerName == null)
            {
                throw new ArgumentNullException("headerName");
            }

            if (headerValue == null)
            {
                throw new ArgumentNullException("headerValue");
            }

            HeaderValueChanged(headerName, headerValue);

            switch (headerName.ToUpperInvariant())
            {
            // See http://tools.ietf.org/html/rfc5322#section-3.6.3
            case "TO":
                this.To = MessageHeader.ParseAddresses(headerValue);
                break;

            // See http://tools.ietf.org/html/rfc5322#section-3.6.3
            case "CC":
                this.Cc = MessageHeader.ParseAddresses(headerValue);
                break;

            // See http://tools.ietf.org/html/rfc5322#section-3.6.3
            case "BCC":
                this.Bcc = MessageHeader.ParseAddresses(headerValue);
                break;

            // See http://tools.ietf.org/html/rfc5322#section-3.6.2
            case "FROM":
                // There is only one MailAddress in the from field
                this.From = MessageAddress.ParseAddress(headerValue);
                break;

            // http://tools.ietf.org/html/rfc5322#section-3.6.2
            // The implementation here might be wrong
            case "REPLY-TO":
                // This field may actually be a list of addresses, but no
                // such case has been encountered
                this.ReplyTo = MessageAddress.ParseAddress(headerValue);
                break;

            // http://tools.ietf.org/html/rfc5322#section-3.6.2
            case "SENDER":
                this.Sender = MessageAddress.ParseAddress(headerValue);
                break;

            // See http://tools.ietf.org/html/rfc5322#section-3.6.5
            // RFC 5322:
            // The "Keywords:" field contains a comma-separated list of one or more
            // words or quoted-strings.
            // The field are intended to have only human-readable content
            // with information about the message
            case "KEYWORDS":
                var keywordsTemp = headerValue.Split(",");
                foreach (String keyword in keywordsTemp)
                {
                    // Remove the quotes if there is any
                    Keywords.Add(Utility.RemoveQuotesIfAny(keyword.Trim()));
                }
                break;

            // See http://tools.ietf.org/html/rfc5322#section-3.6.7
            case "RECEIVED":
                // Simply add the value to the list
                Received.Add(headerValue.Trim());
                break;

            case "IMPORTANCE":
                Importance = HeaderFieldParser.ParseImportance(headerValue.Trim());
                break;

            // See http://tools.ietf.org/html/rfc3798#section-2.1
            case "DISPOSITION-NOTIFICATION-TO":
                this.DispositionNotificationTo = MessageHeader.ParseAddresses(headerValue);
                break;

            case "MIME-VERSION":
                MimeVersion = headerValue.Trim();
                break;

            // See http://tools.ietf.org/html/rfc5322#section-3.6.5
            case "SUBJECT":
            case "THREAD-TOPIC":
                Subject = EncodedWord.Decode(headerValue);
                break;

            // See http://tools.ietf.org/html/rfc5322#section-3.6.7
            case "RETURN-PATH":
                // Return-paths does not include a username, but we
                // may still use the address parser
                this.ReturnPath = MessageAddress.ParseAddress(headerValue);
                break;

            // See http://tools.ietf.org/html/rfc5322#section-3.6.4
            // Example Message-ID
            // <*****@*****.**>
            case "MESSAGE-ID":
                MessageId = HeaderFieldParser.ParseId(headerValue);
                break;

            // See http://tools.ietf.org/html/rfc5322#section-3.6.4
            case "IN-REPLY-TO":
                InReplyTo = HeaderFieldParser.ParseMultipleIDs(headerValue);
                break;

            // See http://tools.ietf.org/html/rfc5322#section-3.6.4
            case "REFERENCES":
                References = HeaderFieldParser.ParseMultipleIDs(headerValue);
                break;

            // See http://tools.ietf.org/html/rfc5322#section-3.6.1))
            case "DATE":
                Date     = headerValue.Trim();
                DateSent = Rfc2822DateTime.StringToDate(headerValue);
                break;

            // See http://tools.ietf.org/html/rfc2045#section-6
            // See ContentTransferEncoding class for more details
            case "CONTENT-TRANSFER-ENCODING":
                ContentTransferEncoding = HeaderFieldParser.ParseContentTransferEncoding(headerValue.Trim());
                break;

            // See http://tools.ietf.org/html/rfc2045#section-8
            case "CONTENT-DESCRIPTION":
                // Human description of for example a file. Can be encoded
                ContentDescription = EncodedWord.Decode(headerValue.Trim());
                break;

            // See http://tools.ietf.org/html/rfc2045#section-5.1
            // Example: Content-type: text/plain; charset="us-ascii"
            case "CONTENT-TYPE":
                ContentType = HeaderFieldParser.ParseContentType(headerValue);
                break;

            // See http://tools.ietf.org/html/rfc2183
            case "CONTENT-DISPOSITION":
                ContentDisposition = HeaderFieldParser.ParseContentDisposition(headerValue);
                break;

            // See http://tools.ietf.org/html/rfc2045#section-7
            // Example: <foo4*[email protected]>
            case "CONTENT-ID":
                ContentId = HeaderFieldParser.ParseId(headerValue);
                break;

            case "_REQUEST-LINE_":
                // header could contain request-line that could not be parsed as simple key value pair, so store entire line
                // Example: POST /odata/$batch HTTP/1.1
                RequestLine = headerValue;
                break;

            default:
                // This is an unknown header

                // Custom headers are allowed. That means headers
                // that are not mentionen in the RFC.
                // Such headers start with the letter "X"
                // We do not have any special parsing of such

                // Add it to unknown headers
                UnknownHeaders.Add(headerName, headerValue);
                break;
            }
        }
Exemplo n.º 10
0
 protected override Task <bool> Handler(Data data)
 {
     Received.Add(data);
     Console.WriteLine($"{data.IntProp}_{data.StrProp}");
     return(Task.FromResult(true));
 }
Exemplo n.º 11
0
 public void HandleMessage(IMessage message)
 {
     Received.Add(message);
     Latch.Signal();
 }