コード例 #1
0
        public static AuctionEvent From(string messageBody)
        {
            AuctionEvent ev = new AuctionEvent();

            var data = messageBody.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            ev.Fields = data.ToDictionary(d => d.Substring(0, d.IndexOf(":")).Trim(),
                d => d.Substring(d.IndexOf(":") + 1).Trim());

            return ev;
        }
コード例 #2
0
        public static AuctionEvent From(string messageBody)
        {
            AuctionEvent ev = new AuctionEvent();

            var data = messageBody.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

            ev.Fields = data.ToDictionary(d => d.Substring(0, d.IndexOf(":")).Trim(),
                                          d => d.Substring(d.IndexOf(":") + 1).Trim());

            return(ev);
        }
コード例 #3
0
        public void ProcessMessage(jabber.protocol.client.Message message)
        {
            AuctionEvent ev = AuctionEvent.From(message.Body);

            switch (ev.Type)
            {
            case "CLOSE":
                _listener.AuctionClosed();
                break;

            case "PRICE":
                _listener.CurrentPrice(ev.CurrentPrice, ev.Increment, ev.IsFrom(_sniperId));
                break;

            default:
                throw new Exception("Invalid message");
            }
        }