Example #1
0
        public Task <MessageCode> ReadAsync(MessageCode expectedCode)
        {
            return(SocketReadAsync(5)
                   .ContinueWith((Task <byte[]> readHeaderTask) => {
                var header = readHeaderTask.Result;
                var size = IPAddress.NetworkToHostOrder(BitConverter.ToInt32(header, 0));
                var messageCode = (MessageCode)header[sizeof(int)];

                if (messageCode == MessageCode.ErrorResp)
                {
                    return DeserializeInstanceAsync <RpbErrorResp>(size)
                    .ContinueWith <MessageCode>((Task <RpbErrorResp> finishedTask) => {
                        var error = finishedTask.Result;
                        throw new RiakException(error.errcode, error.errmsg.FromRiakString(), false);
                    });
                }

                if (expectedCode != messageCode)
                {
                    throw new RiakException("Expected return code {0} received {1}".Fmt(expectedCode, messageCode));
                }

                return TaskResult(messageCode);
            }).Unwrap());
        }
Example #2
0
 static MessageCode doSendRankPrize(CrosscrowdInfoEntity crowd, CrosscrowdSendRankPrizeEntity entity, int maxPoint, int maxLegendCount)
 {
     try
     {
         if (entity.Status != 0)
         {
             return(MessageCode.Success);
         }
         if (entity.Score <= 0)
         {
             return(MessageCode.Success);
         }
         string      prizeItemString = "";
         var         mail            = new MailBuilder(entity.ManagerId, EnumMailType.CrossCrowdRank, entity.Rank);
         MessageCode mess            = BuildPrizeMail(crowd, mail, EnumCrowdPrizeCategory.CrossRank, entity.Rank, maxPoint, maxLegendCount, ref prizeItemString);
         if (mess != MessageCode.Success)
         {
             return(mess);
         }
         entity.Status = 1;
         CrosscrowdInfoMgr.SaveRankPrizeStatus(entity.Idx, entity.Status);
         if (!mail.Save(entity.SiteId))
         {
             return(MessageCode.NbParameterError);
         }
         SavePrizeRecord(entity.ManagerId, EnumCrowdPrizeCategory.CrossRank, "history:" + entity.Idx,
                         prizeItemString, entity.SiteId);
     }
     catch (Exception ex)
     {
         SystemlogMgr.Error("CrossCrowd-doSendRankPrize", ex);
         return(MessageCode.NbParameterError);
     }
     return(MessageCode.Success);
 }
Example #3
0
        public void Non_Generic_Wait_Invocation_Creates_Valid_Wait(MessageCode code, string token, int?timeout)
        {
            var key = new WaitKey(code, token);

            using (var waiter = new Waiter())
            {
                Task task = waiter.Wait(key, timeout);

                var waits = waiter.GetProperty <ConcurrentDictionary <WaitKey, ConcurrentQueue <PendingWait> > >("Waits");
                waits.TryGetValue(key, out var queue);
                queue.TryPeek(out var wait);

                Assert.IsType <Task <object> >(task);
                Assert.NotNull(task);
                Assert.Equal(TaskStatus.WaitingForActivation, task.Status);

                Assert.NotEmpty(waits);
                Assert.Single(waits);

                Assert.NotNull(queue);
                Assert.Single(queue);
                Assert.NotEqual(new DateTime(), wait.DateTime);

                if (timeout != null)
                {
                    Assert.Equal(timeout, wait.TimeoutAfter);
                }
            }
        }
Example #4
0
 public async Task SendTextMessageAsync(UpdateMessage message, MessageCode messageCode, ParseMode parseMode = ParseMode.Default)
 {
     await TelegramBot.SendTextMessageAsync(
         message.ChatId,
         _localizer.GetMessage(message.LanguageCode, messageCode),
         parseMode);
 }
Example #5
0
        public void ProcessMessageSend(MessageCode code)
        {
            switch (code)
            {
            case MessageCode.ConnectToServer:
                Console.WriteLine("ConnectToServer...");
                _ClientSocket.BeginReceive(_Buffer, 0, _Buffer.Length, SocketFlags.None, new AsyncCallback(MessageReceiveCallback), _ClientSocket);
                break;

            case MessageCode.StartGame:
                _ClientSocket.BeginReceive(_Buffer, 0, _Buffer.Length, SocketFlags.None, new AsyncCallback(MessageReceiveCallback), _ClientSocket);
                Console.WriteLine("Játék indítása...");
                break;

            case MessageCode.NextPlayer:
                _ClientSocket.BeginReceive(_Buffer, 0, _Buffer.Length, SocketFlags.None, new AsyncCallback(MessageReceiveCallback), _ClientSocket);
                Console.WriteLine("Következő játékos...");
                break;

            case MessageCode.Step:
                _ClientSocket.BeginReceive(_Buffer, 0, _Buffer.Length, SocketFlags.None, new AsyncCallback(MessageReceiveCallback), _ClientSocket);
                Console.WriteLine("Lépés...");
                break;
            }
        }
Example #6
0
        public async Task Process_CommandMessage_SourceHasNotMetric(LangCode langCode, string content, StateType sourceState,
                                                                    MessageCode returnCode)
        {
            int    externalId = 1;
            string name       = "Koko";
            var    source     = new Source(externalId, name);

            source.UpdateState(sourceState);
            SourceRepoMock.Setup(r => r.FindOrCreateNew(externalId, name)).Returns(() => source);

            var message = new CommandUpdateMessage
            {
                ChatId       = externalId,
                Username     = name,
                Content      = content,
                LanguageCode = langCode,
            };

            await message.Accept(MessageProcessor);

            var localizer = new Localizer();
            var text      = localizer.GetMessage(langCode, returnCode);

            BotResponseMock.Verify(x => x.Response(text), Times.Once);
        }
Example #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MatchResultEntity"/> class.
 /// </summary>
 /// <param name="homeScore">The home score.</param>
 /// <param name="awayScore">The away score.</param>
 /// <param name="process">The process.</param>
 /// <param name="errorCode">The error code.</param>
 public MatchResultEntity(int homeScore, int awayScore, byte[] process, MessageCode errorCode)
 {
     this.AwayScore = awayScore;
     this.HomeScore = homeScore;
     this.Process   = process;
     this.ErrorCode = errorCode;
 }
Example #8
0
    public static void RemoveListener(MessageCode type, Act act)
    {
        if (messageTable.ContainsKey(type))
        {
            Delegate d = messageTable[type];

            if (d == null)
            {
                MyGameServer.MyGameServer.log.Info(string.Format("Attempting to remove listener with for event type \"{0}\" but current listener is null.", type));
            }
            else if (d.GetType() != act.GetType())
            {
                MyGameServer.MyGameServer.log.Info(string.Format("Attempting to remove listener with inconsistent signature for event type {0}. Current listeners have type {1} and listener being removed has type {2}", type, d.GetType().Name, act.GetType().Name));
            }
            else
            {
                messageTable[type] = (Act)messageTable[type] - act;
                if (d == null)
                {
                    messageTable.Remove(type);
                }
            }
        }
        else
        {
            MyGameServer.MyGameServer.log.Info(string.Format("Attempting to remove listener for type \"{0}\" but Messenger doesn't know about this event type.", type));
        }
    }
Example #9
0
        public void Msg(MessageType type, MessageCode code, string format, params object[] args)
        {
            DataTable t;

            switch (type)
            {
            default:
            case MessageType.Error:
                t = this.ds.Tables[INFO_TABLENAME];
                break;

            case MessageType.Info:
                t = this.ds.Tables[INFO_TABLENAME];
                break;

            case MessageType.Warn:
                t = this.ds.Tables[INFO_TABLENAME];
                break;
            }
            DataRow r = t.NewRow( );

            r[TIMESTAMP_COLUMNNAME]  = DateTime.Now;
            r[TYPE_COLUMNNAME]       = type;
            r[CODE_COLUMNNAME]       = code;
            r[DESCRIPTION_COLUMNAME] = string.Format(format, args);
            t.Rows.Add(r);
        }
Example #10
0
        public static IPacket Create(Session session, byte[] data)
        {
            IPacket     p    = null;
            MessageCode code = (MessageCode)data[0];

            if (typeLookup.ContainsKey(code))
            {
                var  types = typeLookup[code];
                Type type;
                if (tieBreakers.ContainsKey(code))
                {
                    type = tieBreakers[code](session, data);
                }
                else
                {
                    type = types.First();
                }

                if (type != null)
                {
                    if (type.Equals(typeof(SftpPacket)))
                    {
                        p = CreateSftp(session, data);
                    }
                    else
                    {
                        p = Build(data, type);
                    }
                }
            }
            return(p);
        }
Example #11
0
    private void bind()
    {
        model         = BlogManager.GetInstance().BlogBaseModel;
        txtTitle.Text = model.BlogModel.Title;
        txtUrl.Text   = model.BlogModel.Url;
        txtEmail.Text = model.BlogModel.EMail;

        txtName.Text             = model.BlogModel.Name;
        txtNickName.Text         = model.BlogModel.NickName;
        txtIntroduction.Text     = model.BlogModel.Introduction;
        ddlAddress.SelectedValue = model.BlogModel.Address;
        txtHobby.Text            = model.BlogModel.Hobby;
        ddlGender.SelectedValue  = ((BlogConst.Gender)model.BlogModel.Gender).ToString();

        rblAlram.SelectedValue              = model.BlogModel.Alarm.ToString();
        rblAutoClip.SelectedValue           = model.BlogModel.AutoClip.ToString();
        rblPostCount.SelectedValue          = model.BlogModel.PostCount.ToString();
        rblRecentComment.SelectedValue      = model.BlogModel.RecentCommentListCount.ToString();
        rblRecentArticleCount.SelectedValue = model.BlogModel.RecentArticleListCount.ToString();
        rblUseEmoticon.SelectedValue        = model.BlogModel.UseEmoticon.ToString();
        ddlNewIcon.SelectedValue            = model.BlogModel.PeridoNewIcon.ToString();

        if (model.BlogModel.Picture != string.Empty)
        {
            lblMyPicture.Text = BlogManager.GetInstance().GetMyPictureForImgTag();
        }
        else
        {
            lblMyPicture.Text = MessageCode.GetMessageByCode(BlogConst.MESSAGE_HAS_NOT_MYPICTURE);
        }
    }
Example #12
0
        public static T Create <T>(MessageCode code) where T : IResponse, new()
        {
            T response = new T();

            response.Code = (int)code;
            return(response);
        }
Example #13
0
        public void ParseMessageType(String messaget)
        {
            switch (messaget)
            {
            case REGISTER_FLAG:
                MessageType = MessageCode.Register;
                break;

            case CONFIRMATION_FLAG:
                MessageType = MessageCode.Confirmation;
                break;

            case UPDATE_FLAG:
                MessageType = MessageCode.Update;
                break;

            case PINGENTITY_FLAG:
                MessageType = MessageCode.PingEntity;
                break;

            case ORDER_FLAG:
                MessageType = MessageCode.Order;
                break;
            }
        }
Example #14
0
        public Task SendTextMessageAsync(UpdateMessage message, MessageCode messageCode, ParseMode parseMode = ParseMode.Default)
        {
            var text = _localizer.GetMessage(message.LanguageCode, messageCode);

            _botResponse.Response(text);
            return(Task.CompletedTask);
        }
Example #15
0
 private Message(MessageCode code, string text, MessageKind kind, params Diagnostics.Span[] carets)
 {
     this.code = code;
     this.text = text;
     this.kind = kind;
     this.spans = carets;
 }
Example #16
0
 public static void Show(MessageCode enmMessegeCode, MessageType enmMessageType, Page p)
 {
     switch (enmMessageType)
     {
         case MessageType.Confirmation:
         {
             ShowMessage(GetMessage(enmMessegeCode), "Confirmation", "msgConfirmation", p);
             break;
         }
         case MessageType.Error:
         {
             ShowMessage(GetMessage(enmMessegeCode), "Error", "msgError", p);
             break;
         }
         case MessageType.Information:
         {
             ShowMessage(GetMessage(enmMessegeCode), "Information", "msgInformation", p);
             break;
         }
         case MessageType.Warning:
         {
             ShowMessage(GetMessage(enmMessegeCode), "Warning", "msgWarning", p);
             break;
         }
         default:
             break;
     }
 }
 internal void OnError(MessageCode code, string data)
 {
     if (Errors != null)
     {
         Errors(code, data);
     }
 }
 internal void OnServerOutput(MessageCode code, string data)
 {
     if (ServerOutput != null)
     {
         ServerOutput(code, data);
     }
 }
Example #19
0
 public SatusMessageInfo(MessageType type, MessageCode code, object bo, string msg)
 {
     this.MsgType = type;
     this.Code    = code;
     this.BO      = bo;
     this.Message = msg;
 }
Example #20
0
        public void Register(MessageCode messageId, MessageType messageType, Type type, IMessageHandler messageHandler, int requiredWork)
        {
            var metadata = new MessageMetadata(messageId, messageType, type, messageHandler, requiredWork);

            _messageIdMap.Add((short)messageId, metadata);
            _messageTypeMap.Add(type, metadata);
        }
Example #21
0
            public static Message GetMessageFromByteArray(byte[] message, bool isDeviceEvent = false)
            {
                if (message.Length < 3)
                {
                    throw new ArgumentException("Message is too short.");
                }
                if (message[0] != StartByte)
                {
                    throw new ArgumentException(string.Format("Message starts with invalid character 0x{0:X2}.", message[0]));
                }
                if (message[message.Length - 1] != EndByte)
                {
                    throw new ArgumentException(string.Format("Message ends with invalid character 0x{0:X2}.", message[message.Length - 1]));
                }
                byte[] innerMessage;
                if (message.Length > 3)
                {
                    innerMessage = new byte[message.Length - 3];
                    Array.Copy(message, 2, innerMessage, 0, innerMessage.Length);
                }
                else
                {
                    innerMessage = new byte[] { };
                }
                MessageCode code = new MessageCode(isDeviceEvent, message[1]);

                return(code.GenerateNewMessage(innerMessage, out innerMessage));
            }
        public static bool InterpretString(string streamData, out Message returnMessage)
        {
            returnMessage = null;

            // Remove new line endings and checks for null values
            while (streamData.EndsWith("\r\n"))
            {
                streamData = streamData.Substring(0, streamData.Length - 2);
            }
            if (string.IsNullOrEmpty(streamData))
            {
                return(false);
            }

            // Extract Error Code
            int errorCodeNum;

            if (!int.TryParse(streamData.Substring(2, 3), out errorCodeNum))
            {
                return(false);
            }
            MessageCode code = (MessageCode)errorCodeNum;

            // Extract Sender ID
            int messageStart = streamData.IndexOf("\r\n") + 2;
            int mesSenderID;

            if (!int.TryParse(streamData.Substring(messageStart, 4), out mesSenderID))
            {
                return(false);
            }

            // Extract Receiver ID
            int receiverID;

            if (!int.TryParse(streamData.Substring(messageStart + 4, 4), out receiverID))
            {
                return(false);
            }

            // Extract Data
            messageStart += 8;
            int    messageEnd      = streamData.LastIndexOf("\r\n\r\n##");
            string receivedMessage = streamData.Substring(messageStart,
                                                          messageEnd - messageStart);

            // Extract File Time
            messageEnd += 6;
            string FileTime = streamData.Substring(messageEnd,
                                                   (streamData.Length - messageEnd) - 2);
            long FileTimeVal;

            if (!long.TryParse(FileTime, out FileTimeVal))
            {
                return(false);
            }

            returnMessage = new Message(code, mesSenderID, receiverID, receivedMessage, FileTimeVal);
            return(true);
        }
 public static CompilationMessage CreateNonCodeMessage(
     MessageCode code,
     string helpfullmessage   = null,
     MessageSeverity severity = MessageSeverity.Error)
 {
     return(new CompilationMessage(severity, code, "", "", "", helpfullmessage, null, -1));
 }
Example #24
0
 protected Message(MessageSeverity severity, MessageCode code, string message)
 {
     Severity = severity;
     Code     = code;
     Location = Runtime.Location.NoLocation;
     Msg      = message;
 }
Example #25
0
 private Message(MessageCode code, string type = "message", string extraDetail = null)
 {
     this.Code        = code;
     this.Type        = type;
     this.Detail      = detailsMapping[code];
     this.ExtraDetail = extraDetail;
 }
Example #26
0
        /// <summary>
        /// GetMessage method creates a single string with replaced placeholders from message.
        /// </summary>
        /// <param name="language">Language of the message from the LanguageEnum enum.</param>
        /// <returns>String representing the message.</returns>
        public string GetMessage(LanguageEnum language = LanguageEnum.En)
        {
            // Build a new message
            StringBuilder sb = new StringBuilder();

            // Add attribute, if present
            if (AttributeName != null)
            {
                sb.Append(AttributeName + " - ");
            }
            // Try to get message text
            if (MessagesEn.Messages.ContainsKey(MessageCode))
            {
                sb.Append(MessagesEn.Messages[MessageCode]);
            }
            else
            {
                sb.Append(MessageCode.ToString());
                Logger.LogToConsole($"Unknown message code {MessageCode}");
            }

            // Replace placeholders
            for (int i = 0; i < Placeholders.Count; i++)
            {
                sb.Replace($"{{{i}}}", Placeholders[i]);
            }
            return(sb.ToString());
        }
Example #27
0
        public static RootResponse <T> CreateRoot <T>(MessageCode code)
        {
            var response = new RootResponse <T>();

            response.Code = (int)code;
            return(response);
        }
Example #28
0
        public static string GetMessageWithData(MessageCode errorCode, string value)
        {
            string messageTemplate = keysError[errorCode];
            string message         = string.Format(messageTemplate, value);

            return(message);
        }
Example #29
0
 protected Message(MessageSeverity severity, MessageCode code, ILocated located)
 {
     Severity = severity;
     Code     = code;
     Location = located.Location;
     Msg      = Subject(Location);
 }
        public async void SendMessage(MessageCode msgCode, byte[] data)
        {
            Remote_Content_Show_Header header = new Remote_Content_Show_Header(msgCode, data.Length, RemoteType.Client);
            byte[] headerBytes = header.ToByte;

            try
            {
               
                    this.writer.WriteBytes(headerBytes);
                    this.writer.WriteBytes(data);

                    await this.writer.StoreAsync();

                    await this.writer.FlushAsync();
                
            }
            catch (Exception)
            {
                this.Stop();

                if (this.OnConnectionLost != null)
                {
                    this.OnConnectionLost();
                }
            }
        }
 protected void FireOnMessageReceived(byte[] messageData, MessageCode code, IPAddress ip)
 {
     if (this.OnMessageReceived != null)
     {
         OnMessageReceived(this, new MessageRecivedEventHandler(messageData, code, ip));
     }
 }
Example #32
0
 public SatusMessageInfo(MessageType type, MessageCode code, object bo, string msg)
 {
     this.MsgType = type;
     this.Code = code;
     this.BO = bo;
     this.Message = msg;
 }
Example #33
0
        public RiakResult Read(IRiakCommand command)
        {
            bool done = false;

            do
            {
                MessageCode expectedCode = command.ExpectedCode;
                Type        expectedType = MessageCodeTypeMapBuilder.GetTypeFor(expectedCode);

                int size = DoRead(expectedCode, expectedType);

                RpbResp response = DeserializeInstance(expectedType, size);
                command.OnSuccess(response);

                var streamingResponse = response as IRpbStreamingResp;
                if (streamingResponse == null)
                {
                    done = true;
                }
                else
                {
                    done = streamingResponse.done;
                }
            }while (done == false);

            return(RiakResult.Success());
        }
Example #34
0
 private Message(MessageCode code, string text, MessageKind kind, params Diagnostics.Span[] carets)
 {
     this.code  = code;
     this.text  = text;
     this.kind  = kind;
     this.spans = carets;
 }
Example #35
0
 public Message(bool flag, string msg, DateTime time, object data, MessageCode code)
 {
     this.Flag = flag;
     this.Msg = msg;
     this.Data = data;
     this.Time = time;
     this.Code = code;
 }
Example #36
0
 public void HandleRequest(MessageCode code, object data)
 {
     ScheduleCell cell = data as ScheduleCell;
     TabPage page = this.Parent as TabPage;
     if (page != null)
     {
         page.BringToTop();
     }
 }
Example #37
0
        internal Diagnostic(MessageCode messageCode, int columnStart, int columnEnd, params object[] messageArgs)
        {
            Info = DiagnosticMessage.GetFromCode[(int)messageCode];

            ColumnStart = Math.Max(columnStart, 0);
            ColumnEnd   = Math.Max(columnEnd,   0);

            Message = String.Format(Info.MessageTemplate, messageArgs);
            MessageArgs = messageArgs;
        }
    public void SendMessage(MessageCode code, JSONObject data, Action<JSONObject> ack = null)
    {
        if (data != null)
        {
            if (!_socket.IsConnected)
            {
                Debug.LogError("Not connected to server");
                return;
            }

            data.AddField("o", (int)code);
            if (ack != null)
            {
                _socket.Emit("message", data, ack);
            }
            else
            {
                _socket.Emit("message", data);
            }
        }
    }
Example #39
0
            /// <summary>
            /// Combine message code and data into a byte packet
            /// </summary>
            /// <param name="messageCode"></param>
            /// <param name="data">Only ASCII characters string.</param>
            /// <returns></returns>
            /// <remarks>String passed as parameter is converted to ASCII so it should not contain any non-ascii characters.</remarks>
            private static byte[] Combine(MessageCode messageCode, string data)
            {
                byte[] packet = Combine(messageCode);
                System.Text.Encoding.ASCII.GetBytes(data).CopyTo(packet, 4);

                return packet;
            }
Example #40
0
            /// <summary>
            /// Combine message code and data into a byte packet
            /// </summary>
            /// <param name="messageCode"></param>
            /// <param name="data"></param>
            /// <returns></returns>
            private static byte[] Combine(MessageCode messageCode, byte[] data)
            {
                byte[] packet = Combine(messageCode);
                data.CopyTo(packet, 4);

                return packet;
            }
Example #41
0
            /// <summary>
            /// Combine message code into a byte packet
            /// </summary>
            /// <param name="messageCode"></param>
            /// <returns></returns>
            private static byte[] Combine(MessageCode messageCode)
            {
                byte[] packet = new byte[PacketSizeConst];
                BitConverter.GetBytes((Int32)messageCode).CopyTo(packet, 0);

                return packet;
            }
        private void SocketHandler_OnMessageBytesReceived(MessageCode code, byte[] bytes)
        {
            if (code == MessageCode.MC_Job)
            {
                RCS_Job job = Remote_Content_Show_MessageGenerator.GetMessageFromByte<RCS_Job>(bytes);

                this.socketHandler.Close();

                if (this.OnJobConfigurationReceived != null)
                {
                    this.OnJobConfigurationReceived(job.Configuration);
                }
            }
            else if (code == MessageCode.MC_Job_Cancel)
            {
                RCS_Job_Cancel cancel = Remote_Content_Show_MessageGenerator.GetMessageFromByte<RCS_Job_Cancel>(bytes);

                this.socketHandler.Close();

                if (this.OnCancelRequestReceived != null)
                {
                    this.OnCancelRequestReceived(cancel.JobID, cancel.Reason);
                }
            }
            else if (code == MessageCode.MC_Configuration_Image)
            {
                RCS_Configuration_Image image = Remote_Content_Show_MessageGenerator.GetMessageFromByte<RCS_Configuration_Image>(bytes);

                this.socketHandler.Close();

                if (this.OnConfigurationImageReceived != null)
                {
                    this.OnConfigurationImageReceived(image.Picture);
                }
            }
            else if (code == MessageCode.MC_Event_List_Request)
            {
                RCS_Event_List_Request events = Remote_Content_Show_MessageGenerator.GetMessageFromByte<RCS_Event_List_Request>(bytes);

                if (this.OnEventRequestReceived != null)
                {
                    this.OnEventRequestReceived(this);
                }
            }
            else if (code == MessageCode.MC_FileAdd)
            {
                RCS_FileAdd newFile = Remote_Content_Show_MessageGenerator.GetMessageFromByte<RCS_FileAdd>(bytes);

                this.socketHandler.Close();

                if (this.OnLocalFileAddRequestReceived != null)
                {
                    this.OnLocalFileAddRequestReceived(newFile.Data, newFile.Name);
                }

            }
            else if (code == MessageCode.MC_FileDelete)
            {
                RCS_FileDelete deleteFile = Remote_Content_Show_MessageGenerator.GetMessageFromByte<RCS_FileDelete>(bytes);

                this.socketHandler.Close();

                if (this.OnLocalFileRemoveRequestReceived != null)
                {
                    this.OnLocalFileRemoveRequestReceived(deleteFile.Name);
                }
            }
            else if (code == MessageCode.MC_GetFiles)
            {
                RCS_GetFiles listRequest = Remote_Content_Show_MessageGenerator.GetMessageFromByte<RCS_GetFiles>(bytes);

                if (this.OnLocalFileListRequestReceived != null)
                {
                    this.OnLocalFileListRequestReceived(this);
                }
            }
        }
Example #43
0
 public static Message Make(MessageCode code, string text, MessageKind kind, params Diagnostics.Span[] carets)
 {
     return new Message(code, text, kind, carets);
 }
 /// <summary>
 /// provides a messaging system dedicated to send messages to the user interface without knowing it
 /// </summary>
 /// <param name="text">the text of the message</param>
 /// <param name="code">how the message is classificated</param>
 public Message(string text, MessageCode code = MessageCode.Notification)
 {
     MessageText = text;
     MessageCode = code;
 }
 public RpbReq(MessageCode messageCode)
 {
     this.messageCode = messageCode;
     this.isMessageCodeOnly = true;
 }
Example #46
0
 public static void WriteInfo(String message, MessageCode code)
 {
     if (!s_bSilent)
     {
         // We've decided to still use TlbImp prefix to tell user that this message is outputed by TlbImp
         // and we hide the message code
         String messageFormat = "TlbImp : {0}";
         Console.WriteLine(messageFormat, message);
     }
 }
Example #47
0
 internal static void AddError(CodeElement e, string message, Scanner.Token token, string rulestack = null, MessageCode code = MessageCode.SyntaxErrorInParser)
 {
     e.Diagnostics.Add(new ParserDiagnostic(message, token, rulestack, code));
 }
Example #48
0
 internal static void AddError(CodeElement e, string message, MessageCode code = MessageCode.SyntaxErrorInParser)
 {
     e.Diagnostics.Add(new ParserDiagnostic(message, e.StartIndex+1, e.StopIndex+1, e.ConsumedTokens[0].Line, null, code));
 }
Example #49
0
 internal static void AddError(CodeElement e, string message, Antlr4.Runtime.RuleContext context, MessageCode code = MessageCode.SyntaxErrorInParser)
 {
     AddError(e, message, ParseTreeUtils.GetFirstToken(context), new RuleStackBuilder().GetRuleStack(context), code);
 }
 public ParserDiagnostic(string message, IToken offendingSymbol, string ruleStack, MessageCode code = MessageCode.SyntaxErrorInParser)
     : base(code, offendingSymbol == null ? -1 : offendingSymbol.Column, offendingSymbol == null ? -1 : (offendingSymbol.StopIndex < 0 ? -1 : (offendingSymbol.StopIndex+1)), message)
 {
     OffendingSymbol = offendingSymbol;
     this.ruleStack = ruleStack;
 }
 public ParserDiagnostic(string message, int start, int stop, int line, string ruleStack, MessageCode code = MessageCode.SyntaxErrorInParser)
     : base(code, start, stop, message)
 {
     this.line = line;
     this.ruleStack = ruleStack;
 }
 public static string GetTypeNameFor(MessageCode messageCode)
 {
     return MessageCodeToTypeMap[messageCode].Name;
 }
Example #53
0
        public void HandleRequest(MessageCode code, object data)
        {

        }
Example #54
0
 public void HandleRequest(MessageCode code, object data)
 {
     //MessageBox.Show("Schedule.HandleRequest");
 }
 internal TokenDiagnostic(MessageCode messageCode, Token token, params object[] messageArgs) :
     base(messageCode, token.Column, token.EndColumn, messageArgs)
 {
     Token = token;
 }
 public static bool Contains(MessageCode messageCode)
 {
     return MessageCodeToTypeMap.ContainsKey(messageCode);
 }
 /// <summary>
 /// invokes the NewMessage event
 /// </summary>
 /// <param name="sender">the sender of the message. In most cases its 'this'"</param>
 /// <param name="messageText">the text of the message</param>
 /// <param name="code">how the message if classified</param>
 public static void SendMessage(object sender, string messageText, MessageCode code = MessageCode.Notification)
 {
     SendMessage(sender, new Message(messageText, code));
 }
 private void HandleErrors(MessageCode code, SourceLocation sourceLocation, string message, object[] args)
 {
     if (sourceLocation != null) {
         _errors.Add(
             "{0}({1},{2}):AP{3}:{4}".format(
                 sourceLocation.SourceFile, sourceLocation.Row, sourceLocation.Column, (int)code,
                 message.format(args)));
     } else {
         _errors.Add(":AP{0}:{1}".format((int)code, message.format(args)));
     }
 }
        private void HandleWarnings(MessageCode code, SourceLocation sourceLocation, string message, object[] args)
        {
            var warning = string.Empty;

            if (sourceLocation != null) {
                warning = "{0}({1},{2}):AP{3}:{4}".format(
                    sourceLocation.SourceFile, sourceLocation.Row, sourceLocation.Column, (int)code,
                    message.format(args));
                _warnings.Add(warning);
            } else {
                warning = ":AP{0}:{1}".format((int)code, message.format(args));
                _warnings.Add(warning);
            }
            using (new ConsoleColors(ConsoleColor.Yellow, ConsoleColor.Black)) {
                Console.WriteLine(warning);
            }
        }
 public static Type GetTypeFor(MessageCode messageCode)
 {
     return MessageCodeToTypeMap[messageCode];
 }