public override void OnMsg(MsgType msgType, object msg) { switch (msgType) { case MsgType.MissionBottleNum: mLevel = (int)msg; LevelData mlevelData = GameManager.Instance.mGameDataManager.GetLevelData(mLevel); int smallNum = 0; int mediuNum = 0; int bigNum = 0; mlevelData.BottleGetDataGroup.ApplyAllItem(C => { switch (C.mFragmentType) { case FragmentType.Big: bigNum+= C.GetFragNum; break; case FragmentType.Medium: mediuNum += C.GetFragNum; break; case FragmentType.Small: smallNum += C.GetFragNum; break; } }); mBottleGrouup[0].SetMyFragments(smallNum,FragmentType.Small); mBottleGrouup[1].SetMyFragments(mediuNum,FragmentType.Medium); mBottleGrouup[2].SetMyFragments(bigNum,FragmentType.Big); GameManager.Instance.StartGame (mLevel); UIManager.Instance.SendMsg(UIType.GamePlay,MsgType.PauseGame,mLevel); break; } }
public static Dictionary<string, string> GetMessageList(AppLanguage Language, MsgType msgType) { XmlNode nodex = null; Dictionary<string, string> dic = new Dictionary<string, string>(); switch (Language) { case AppLanguage.CN: if (docCN == null) { docCN = new XmlDocument(); docCN.Load(ApplicationConfiguration.AppRoot + @"\LanguageMessage\zh-CN.xml"); } nodex = docCN.SelectSingleNode("//root/" + msgType.ToString()); break; } if (nodex != null && nodex.ChildNodes != null) { foreach (XmlNode node in nodex.ChildNodes) { dic.Add(node.Attributes["value"].Value, node.InnerText); } } return dic; }
public static string GetMessage(MsgType msgType, string messageID, string para1, string para2) { string result = GetMessage(msgType, messageID); result = System.Text.RegularExpressions.Regex.Replace(result, "%1", para1); result = System.Text.RegularExpressions.Regex.Replace(result, "%2", para2); return result; }
public void ShowAlert(string text, MsgType msgType) { string baseClass = "alert msgBox text-center"; Panel panel = Master.FindControl("msg") as Panel; Label lbl = Master.FindControl("lblMsg") as Label; if (panel == null) { panel = Master.Master.FindControl("msg") as Panel; lbl = Master.Master.FindControl("lblMsg") as Label; } panel.Visible = true; switch (msgType) { case MsgType.Success: panel.CssClass = baseClass + " alert-success"; break; case MsgType.Error: panel.CssClass = baseClass + " alert-danger"; break; case MsgType.Warning: panel.CssClass = baseClass + " alert-warning"; break; } lbl.Text = text; }
public Msg(string text, MsgType type, Exception ex) { Text = text; Type = type; Ex = ex; CreateDate = DateTime.Now; }
private static int GetMsgLength(MsgType msg) { int result=0; switch (msg) { case MsgType.CheckWC: result=CheckWCIndex.MsgArrayLength; break; case MsgType.DataCollectionIndex: result=DataCollectionIndex.MsgArrayLength; break; case MsgType.TestCompletedIndex: result=TestCompletedIndex.MsgArrayLength; break; case MsgType.QueryBoxInfoIndex: result = QueryBoxInfoIndex.MsgArrayLength; break; case MsgType.QueryMBInfoIndex: result = QueryMBInfoIndex.MsgArrayLength; break; case MsgType.Get_LabelLocation: result = GetLabelLocationIndex.MsgArrayLength; break; case MsgType.Process_Completed: result = ProcessCompletedIndex.MsgArrayLength; break; } return result; }
public void ShowMessage(string msg, MsgType msgType) { string title; switch (msgType) { case MsgType.Info: title = "Bilgi"; break; case MsgType.Warning: title = "Uyarı"; break; case MsgType.Error: title = "Hata"; break; default: title = null; break; }; var script = String.Format(@"$.msgBox({{ title: '{2}', content: '{0}', type: '{1}', buttons: [{{ value: 'Ok' }}], }});", msg, msgType.ToString().ToLower(), title); ClientScript += script + "\r\n"; }
private static void ConsoleMsg(string msg, MsgType mt) { switch (mt) { case MsgType.FunctionCall: Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.Green; break; case MsgType.Info: Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.DarkGreen; break; case MsgType.Error: Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.Red; break; case MsgType.NewCall: Console.BackgroundColor = ConsoleColor.DarkRed; Console.ForegroundColor = ConsoleColor.Green; break; default: Console.BackgroundColor=ConsoleColor.White; Console.ForegroundColor=ConsoleColor.Black; msg = $"Unknown Message Type: {mt}. {msg}"; break; } msg = $"{DateTime.Now.ToString("yyMMdd-HHmm")} {msg}"; Console.WriteLine(msg); }
public static string GetMessage(MsgType msgType, string messageID) { XmlNode nodex = null; try { switch (lang) { case AppLanguage.CN: if (docCN == null) { docCN = new XmlDocument(); docCN.Load(ApplicationConfiguration.AppRoot + @"\LanguageMessage\zh-CN.xml"); } nodex = docCN.SelectSingleNode("//root/" + msgType.ToString() + "/" + messageID); break; case AppLanguage.EN: if (docEN == null) { docEN = new XmlDocument(); docEN.Load(ApplicationConfiguration.AppRoot + @"\LanguageMessage\EN.xml"); } nodex = docEN.SelectSingleNode("//root/" + msgType.ToString() + "/" + messageID); break; } } catch (Exception) { } if (nodex != null) return nodex.InnerText; return ""; }
public static string Message(string msg, MsgType type) { String result = ""; if (type.Equals(MsgType.Success)) { result = @"<div class=""notification msgsuccess""> <a class=""close""></a> <p>" + msg + "</p></div>"; } else if (type.Equals(MsgType.Information)) { result = @"<div class=""notification msginfo""> <a class=""close""></a> <p>" + msg + "</p></div>"; } else if (type.Equals(MsgType.Alert)) { result = @"<div class=""notification msgalert""> <a class=""close""></a> <p>" + msg + "</p></div>"; } else if (type.Equals(MsgType.Error)) { result = @"<div class=""notification msgerror""> <a class=""close""></a> <p>" + msg + "</p></div>"; } return result; }
public ChatMessage(String txt, Color c, MsgType type = MsgType.Global, int sender = -1) { this.Color = c; this.Text = txt; this.Type = type; this.Sender = sender; this.Timestamp = DateTime.Now; }
public Message(Mobile from, string sub, string msg, MsgType type) { c_From = from; c_Msg = msg; c_Subject = sub; c_Type = type; c_Received = DateTime.Now; }
public void SendMsg(UIType type,MsgType msgType,object arg) { BaseUI UI = null; if(UIInstsanceGroup.TryGetValue(type,out UI)) { if(UI.gameObject.activeSelf) UI.OnMsg(msgType,arg); } }
public bool CheckLogging(MsgType msgType) { bool flag = true; if (!Logging.useFileLogging && !Logging.useConsoleLogging) flag = false; else if (msgType < Logging.msgFileLevel && msgType < Logging.msgConsoleLevel) flag = false; return flag; }
//给服务器发送上线信息 public void SendClientMsg(MsgType type, int blockTypes, string msg) { //发送开始信息 var message = (int)type + " " + hostName + " " + IPHost.ToString() + " " + "4530"+" "+blockTypes + " " + msg; //将消息发送给服务器端 var outputBuffer = Encoding.Unicode.GetBytes(message); socket.BeginSend(outputBuffer, 0, outputBuffer.Length, SocketFlags.None, null, null); textBox1.Text = "connect to the server"; }
///////////////////////////////////////////////////////////////////////////// // LogService operations public void Message(MsgType type, string format, params object[] arg) { string text = string.Format(format, arg); this.Writer = new StreamWriter(FileName, true); this.Writer.WriteLine(DateTime.Now.ToString("[HH:mm:ss]") + ' ' + text); this.Writer.Close(); if (Log != null) Log(this, new LogEventArgs(ref text, type)); }
public void SendFriendMsg(MsgType type, int blockTypes, string msg, IPEndPoint ipPort) { //消息格式为 消息类型:用户名:IP地址:端口:方块类型:操作消息 string massage = string.Format("{0}:{1}:{2}:{3}:{4}:{5}", (int)type, hostName, IPHost.ToString(), myPort, blockTypes, msg); //将消息转换为可 网络发送的 字节 byte[] msgs = Encoding.Default.GetBytes(massage); //发送 信息, 长度, 好友IP地址 myClient.Send(msgs, msgs.Length, ipPort); }
private void AddText(MsgType msgtype, string msg) { richTextBox1.Invoke(new EventHandler(delegate { richTextBox1.SelectedText = string.Empty; richTextBox1.SelectionFont = new Font(richTextBox1.SelectionFont, FontStyle.Bold); richTextBox1.SelectionColor = MsgTypeColor[(int)msgtype]; richTextBox1.AppendText(msg); richTextBox1.ScrollToCaret(); })); }
/// <summary> /// 发送待办(默认消息需要公司ID) /// </summary> /// <param name="UserAndForm">接收用户与FormID</param> /// <param name="SystemCode">系统代号</param> /// <param name="ModelCode">模块代号</param> /// <param name="strCompanyID">公司ID</param> /// <param name="strXml">业务数据XML</param> /// <param name="msgType">消息类型</param> public void ApplicationEngineTrigger(List<CustomUserMsg> UserAndForm, string SystemCode, string ModelCode, string strCompanyID, string strXml, MsgType msgType) { string ss = ""; foreach (CustomUserMsg list in UserAndForm) { ss += "FormID:" + list.FormID + "UserID:" + list.UserID; } Tracer.Debug("ApplicationEngineTrigger()UserAndForm:" + ss + "SystemCode:" + SystemCode + "ModelCode:" + ModelCode + "strCompanyID:" + strCompanyID + "strXml:" + strXml + "msgType:" + msgType.ToString() + ""); EngineServicesBLL bll = new EngineServicesBLL(); bll.ApplicationEngineTrigger(UserAndForm, SystemCode, ModelCode, strCompanyID, strXml, msgType); }
public static string GetAlertClass(MsgType type) { switch (type) { case MsgType.Error: return "error"; case MsgType.Success: return "success"; case MsgType.Info: return "info"; default: return ""; } }
static Logging() { useFileLogging = false; useConsoleLogging = false; useCommandLineMode = false; useMsgBox = false; useHighResTime = false; msgFileLevel = MsgType.Info; msgConsoleLevel = MsgType.Info; m_logMutex = new Mutex(); m_logFileMaxLength = 41943040L; m_logFileNameAndPath = string.Empty; m_logFilePosition = 0L; }
public SendMsg(MsgType msgType, params string[] args) { this.msgType = msgType; StringBuilder sb = new StringBuilder(); for (int i = 0; i < args.Length; i++) { sb.Append(args[i]); if (i != args.Length - 1) sb.Append(","); } this.msg_content = Encoding.ASCII.GetBytes(sb.ToString().Trim()); this.msg_content_len = this.msg_content.Length; }
public override void OnMsg(MsgType msgType, object msg) { switch (msgType) { case MsgType.None: break; case MsgType.SetLevel: mBottleManager.SetBottle((int)msg); break; case MsgType.ContinueGame: ContinueGame(); break; case MsgType.PauseGame: PauseGame(); break; } }
void GotMidiEventD(MsgType t, int track, int offset, int imsg, byte bmsg, ulong ppq, bool rse) { switch (t) { case MsgType.MetaStr: lve.AddItem( c4, MeasureBarTick( ppq ), ppq.ToString(), MetaHelpers.MetaNameFF( imsg ) , GetMetaString( offset ), SmfStringFormatter.byteToString(GetMetaStringValue(offset)) ); break; case MsgType.MetaInf: case MsgType.System: lve.AddItem( GetEventColor(imsg,cR), MeasureBarTick( ppq ), ppq.ToString(), MetaHelpers.MetaNameFF( imsg ), GetMetaSTR( offset ), SmfStringFormatter.byteToString(GetMetaValue(offset)) ); break; default: if (rse) lve.AddItem( GetRseEventColor( Colors["225"] ), MeasureBarTick( ppq ), ch,GetRseEventString( offset ), chRseV( offset ), SmfStringFormatter.byteToString(GetRseEventValue(offset)) ); else lve.AddItem( GetEventColor ( Colors["225"] ), MeasureBarTick( ppq ), ch,GetEventString ( offset ), chV ( offset ), SmfStringFormatter.byteToString(GetEventValue(offset)) ); break; } }
public override void OnMsg(MsgType msgType, object msg) { switch (msgType) { case MsgType.GameOverData: GameOverData data = (GameOverData)msg; SoundManager.Instance.StopMusic("TimeLimit"); SoundManager.Instance.PlaySound(data.IsWin ? "GameWin" : "GameLose"); //BackgroundSprite.spriteName = data.IsWin ? "WinBg" : "LoseUIBg"; BackgroundSprite.mainTexture = data.IsWin?WndBg:LosBg; NextBtn.SetActive(data.IsWin); ReplayBtn.SetActive(!data.IsWin); ShowBottle(data); if (data.IsWin) GameManager.Instance.mGameDataManager.SaveUnLockLevel(GamePlaySceneMgr.Instance.CurrentLevel); break; } }
public void toAdmin(Message message, SessionID sessionID) { // This is only for the TT dev environment. The production FIX Adapter does not require a password MsgType msgType = new MsgType(); message.getHeader().getField(msgType); TargetCompID targetCompID = new TargetCompID(); message.getHeader().getField(targetCompID); if (msgType.ToString() == MsgType.Logon && (targetCompID.ToString() == "TTDEV9P" || targetCompID.ToString() == "TTDEV9O")) { const string password = "******"; RawData rawData = new RawData(password); message.getHeader().setField(rawData); } // End TT Dev environment case }
/// <summary> /// Method writeMsg /// </summary> /// <param name="type">A Ferda.ModulesManager.MsgType</param> /// <param name="name">A string</param> /// <param name="message">A string</param> /// <param name="__current">An Ice.Current</param> public override void writeMsg(MsgType type, String name, String message, Current __current) { switch(type) { case MsgType.Error: MessageBox.Show( message, name, MessageBoxButtons.OK, MessageBoxIcon.Error); break; case MsgType.Warning: MessageBox.Show( message, name, MessageBoxButtons.OK, MessageBoxIcon.Warning); break; case MsgType.Debug: MessageBox.Show( message, name, MessageBoxButtons.OK, MessageBoxIcon.None); break; case MsgType.Info: MessageBox.Show( message, name, MessageBoxButtons.OK, MessageBoxIcon.Information); break; default: MessageBox.Show( message, name, MessageBoxButtons.OK, MessageBoxIcon.None); break; } }
/// <summary> /// 添加信息 /// 1.添加信息 /// 2.添加信息接收人 /// 3.更新房间最新消息 /// </summary> /// <param name="pars"></param> /// <param name="loginId"></param> /// <param name="msgType"></param> public Tuple<ChatRoom, List<ChatMsgRecipient>> CreateMsgRecord(C103Parameter pars, string loginId, MsgType msgType) { var chatRoom = chatRoomDataStore.GetModel(p => p.Id == pars.RoomId); var chatUser = chatUserDataStore.GetModel(p => p.Id == loginId); if (chatRoom == null) throw new Exception("不存在此会话"); var chatMembers = chatMemberDataStore.GetList(p => p.ChatRoomId == chatRoom.Id); ChatMsgRecord msgRecord = new ChatMsgRecord(); msgRecord.MsgType = msgType; msgRecord.SendDate = DateTime.Now; msgRecord.SendUserId = loginId; msgRecord.SendUserName = chatUser.Name; msgRecord.ChatMsg = pars.Msg; msgRecord.ChatRoomId = chatRoom.Id; chatMsgRecordDataStore.Insert(msgRecord); List<ChatMsgRecipient> msgRecipientList = new List<ChatMsgRecipient>(); foreach (var item in chatMembers) { ChatMsgRecipient msgRecipient = new ChatMsgRecipient(); msgRecipient.ChatMsgRecordId = msgRecord.Id; //不为游客时才推送 if (item.ChatMemberType != ChatMemberType.Visitor) { msgRecipient.MsgReceiveState = MsgReceiveState.Init; } else { msgRecipient.MsgReceiveState = MsgReceiveState.HasRead; } msgRecipient.ReceiveDate = DateTime.Now; msgRecipient.RecipientId = item.ChatUserId; } if (msgRecipientList.Any()) chatMsgRecipientDataStore.InsertBatch(msgRecipientList); chatRoom.NewMsgRecord = msgRecord; chatRoomDataStore.Update(p => p.Id == chatRoom.Id, chatRoom); return new Tuple<ChatRoom, List<ChatMsgRecipient>>(chatRoom, msgRecipientList); }
public static bool IsCorrectMsg(MsgType msg,string[] msgContent, out string msgErr,int IsPassIndex) { msgErr = ""; int correctLen = GetMsgLength(msg); if (correctLen != msgContent.Length) { msgErr = "The length or message array : " + msgContent.Length.ToString() + " is wrong, the correct length is : " + correctLen.ToString(); return true; } if (IsPassIndex != 0) { string isPass = msgContent[IsPassIndex].Trim(); if (isPass != "0" && isPass != "-1") { msgErr = "The IsPass data is wrong, it should be 0 or -1"; return true; } } return false; }
public SendMessageGump(Mobile from, Mobile to, string txt, Message reply, MsgType type) : base(from, 200, 200) { from.CloseGump(typeof(SendMessageGump)); Override = true; c_From = from; c_To = to; c_Text = txt; c_Subject = ""; c_Reply = reply; c_MsgType = type; if (c_Reply != null) { if (c_Reply.Subject.IndexOf("RE:") != 0) c_Subject = "RE: " + c_Reply.Subject; else c_Subject = c_Reply.Subject; } }
public static void ReadHeader(byte value, out ReliabilityMode rel, out BroadcastMode broad, out MsgType msg, out SubMsgType sub) { rel = (ReliabilityMode)(value & ReliabilityMask); broad = (BroadcastMode)(value & BroadcastMask); msg = (MsgType)(value & MsgTypeMask); sub = (SubMsgType)(value & SubTypeMask); }
/// <summary> /// 发送消息 /// </summary> /// <param name="msgType"></param> /// <param name="message"></param> public void SendMessage(MsgType msgType, string message) { DataResponsible.SendMsg(msgType, message); }
/// <summary> /// 创建新的日志记录实例; /// </summary> /// <param name="dt">日志记录的时间</param> /// <param name="t">日志记录的文本内容</param> /// <param name="p">日志记录的消息类型</param> public Msg(DateTime dt, string t, MsgType p) { datetime = dt; type = p; text = t; }
public SactaMsg(MsgType type, ushort id) : this(type, id, 0, null) { }
public override void HandlePacket(BinaryReader reader, int whoAmI) { switch (reader.ReadByte()) { case 0: //server side spawning creepers if (Main.netMode == 2) { byte p = reader.ReadByte(); int multiplier = reader.ReadByte(); int n = NPC.NewNPC((int)Main.player[p].Center.X, (int)Main.player[p].Center.Y, NPCType("CreeperGutted"), 0, p, 0f, multiplier, 0f); if (n != 200) { Main.npc[n].velocity = Vector2.UnitX.RotatedByRandom(2 * Math.PI) * 8; NetMessage.SendData(23, -1, -1, null, n); } } break; case 1: //server side synchronize pillar data request if (Main.netMode == 2) { byte pillar = reader.ReadByte(); if (!Main.npc[pillar].GetGlobalNPC <FargoSoulsGlobalNPC>().masoBool[1]) { Main.npc[pillar].GetGlobalNPC <FargoSoulsGlobalNPC>().masoBool[1] = true; Main.npc[pillar].GetGlobalNPC <FargoSoulsGlobalNPC>().SetDefaults(Main.npc[pillar]); Main.npc[pillar].life = Main.npc[pillar].lifeMax; } } break; case 2: //net updating maso FargoSoulsGlobalNPC fargoNPC = Main.npc[reader.ReadByte()].GetGlobalNPC <FargoSoulsGlobalNPC>(); fargoNPC.masoBool[0] = reader.ReadBoolean(); fargoNPC.masoBool[1] = reader.ReadBoolean(); fargoNPC.masoBool[2] = reader.ReadBoolean(); fargoNPC.masoBool[3] = reader.ReadBoolean(); break; case 3: //rainbow slime/paladin, MP clients syncing to server if (Main.netMode == 1) { byte npc = reader.ReadByte(); Main.npc[npc].lifeMax = reader.ReadInt32(); float newScale = reader.ReadSingle(); Main.npc[npc].position = Main.npc[npc].Center; Main.npc[npc].width = (int)(Main.npc[npc].width / Main.npc[npc].scale * newScale); Main.npc[npc].height = (int)(Main.npc[npc].height / Main.npc[npc].scale * newScale); Main.npc[npc].scale = newScale; Main.npc[npc].Center = Main.npc[npc].position; } break; case 4: //moon lord vulnerability synchronization if (Main.netMode == 1) { int ML = reader.ReadByte(); Main.npc[ML].GetGlobalNPC <FargoSoulsGlobalNPC>().Counter = reader.ReadInt32(); FargoSoulsGlobalNPC.masoStateML = reader.ReadByte(); } break; case 5: //retinazer laser MP sync if (Main.netMode == 1) { int reti = reader.ReadByte(); Main.npc[reti].GetGlobalNPC <FargoSoulsGlobalNPC>().masoBool[2] = reader.ReadBoolean(); Main.npc[reti].GetGlobalNPC <FargoSoulsGlobalNPC>().Counter = reader.ReadInt32(); } break; case 6: //shark MP sync if (Main.netMode == 1) { int shark = reader.ReadByte(); Main.npc[shark].GetGlobalNPC <FargoSoulsGlobalNPC>().SharkCount = reader.ReadByte(); } break; case 7: //client to server activate dark caster family if (Main.netMode == 2) { int caster = reader.ReadByte(); if (Main.npc[caster].GetGlobalNPC <FargoSoulsGlobalNPC>().Counter2 == 0) { Main.npc[caster].GetGlobalNPC <FargoSoulsGlobalNPC>().Counter2 = reader.ReadInt32(); } } break; case 8: //server to clients reset counter if (Main.netMode == 1) { int caster = reader.ReadByte(); Main.npc[caster].GetGlobalNPC <FargoSoulsGlobalNPC>().Counter2 = 0; } break; case 9: //client to server, request heart spawn if (Main.netMode == 2) { int n = reader.ReadByte(); Item.NewItem(Main.npc[n].Hitbox, ItemID.Heart); } break; case 10: //client to server, sync cultist data if (Main.netMode == 2) { int cult = reader.ReadByte(); FargoSoulsGlobalNPC cultNPC = Main.npc[cult].GetGlobalNPC <FargoSoulsGlobalNPC>(); cultNPC.Counter += reader.ReadInt32(); cultNPC.Counter2 += reader.ReadInt32(); cultNPC.Timer += reader.ReadInt32(); Main.npc[cult].localAI[3] += reader.ReadSingle(); } break; case 11: //refresh creeper if (Main.netMode != 0) { byte player = reader.ReadByte(); NPC creeper = Main.npc[reader.ReadByte()]; if (creeper.active && creeper.type == NPCType("CreeperGutted") && creeper.ai[0] == player) { int damage = creeper.lifeMax - creeper.life; creeper.life = creeper.lifeMax; if (damage > 0) { CombatText.NewText(creeper.Hitbox, CombatText.HealLife, damage); } if (Main.netMode == 2) { creeper.netUpdate = true; } } } break; case 77: //server side spawning fishron EX if (Main.netMode == 2) { byte target = reader.ReadByte(); int x = reader.ReadInt32(); int y = reader.ReadInt32(); FargoSoulsGlobalNPC.spawnFishronEX = true; NPC.NewNPC(x, y, NPCID.DukeFishron, 0, 0f, 0f, 0f, 0f, target); FargoSoulsGlobalNPC.spawnFishronEX = false; NetMessage.BroadcastChatMessage(NetworkText.FromLiteral("Duke Fishron EX has awoken!"), new Color(50, 100, 255)); } break; case 78: //confirming fish EX max life int f = reader.ReadInt32(); Main.npc[f].lifeMax = reader.ReadInt32(); break; default: break; } //BaseMod Stuff MsgType msg = (MsgType)reader.ReadByte(); if (msg == MsgType.ProjectileHostility) //projectile hostility and ownership { int owner = reader.ReadInt32(); int projID = reader.ReadInt32(); bool friendly = reader.ReadBoolean(); bool hostile = reader.ReadBoolean(); if (Main.projectile[projID] != null) { Main.projectile[projID].owner = owner; Main.projectile[projID].friendly = friendly; Main.projectile[projID].hostile = hostile; } if (Main.netMode == 2) { MNet.SendBaseNetMessage(0, owner, projID, friendly, hostile); } } else if (msg == MsgType.SyncAI) //sync AI array { int classID = reader.ReadByte(); int id = reader.ReadInt16(); int aitype = reader.ReadByte(); int arrayLength = reader.ReadByte(); float[] newAI = new float[arrayLength]; for (int m = 0; m < arrayLength; m++) { newAI[m] = reader.ReadSingle(); } if (classID == 0 && Main.npc[id] != null && Main.npc[id].active && Main.npc[id].modNPC != null && Main.npc[id].modNPC is ParentNPC) { ((ParentNPC)Main.npc[id].modNPC).SetAI(newAI, aitype); } else if (classID == 1 && Main.projectile[id] != null && Main.projectile[id].active && Main.projectile[id].modProjectile != null && Main.projectile[id].modProjectile is ParentProjectile) { ((ParentProjectile)Main.projectile[id].modProjectile).SetAI(newAI, aitype); } if (Main.netMode == 2) { BaseNet.SyncAI(classID, id, newAI, aitype); } } }
/// <summary> /// 写入新日志,根据指定的日志内容和信息类型,采用当前时间为日志时间写入新日志 /// </summary> /// <param name="text">日志内容</param> /// <param name="type">信息类型</param> public void Write(string text, MsgType type) { Write(new Msg(text, type)); }
public SPPMessage(MessageIds id, MsgType type, byte[] payload) { Id = id; Type = type; Payload = payload; }
/// <summary> /// 发送待办(默认消息需要公司ID) /// </summary> /// <param name="UserAndForm">接收用户与FormID</param> /// <param name="SystemCode">系统代号</param> /// <param name="ModelCode">模块代号</param> /// <param name="strCompanyID">公司ID</param> /// <param name="strXml">业务数据XML</param> /// <param name="msgType">消息类型</param> public void ApplicationEngineTrigger(List <CustomUserMsg> UserAndForm, string SystemCode, string ModelCode, string strCompanyID, string strXml, MsgType msgType) { string ss = ""; foreach (CustomUserMsg list in UserAndForm) { ss += "FormID:" + list.FormID + "UserID:" + list.UserID; } Record.WriteLogFunction("ApplicationEngineTrigger()UserAndForm:" + ss + "SystemCode:" + SystemCode + "ModelCode:" + ModelCode + "strCompanyID:" + strCompanyID + "strXml:" + strXml + "msgType:" + msgType.ToString() + ""); EngineServicesBLL bll = new EngineServicesBLL(); bll.ApplicationEngineTrigger(UserAndForm, SystemCode, ModelCode, strCompanyID, strXml, msgType); }
public void AddDoDask(string companyID, string orderID, string systemCode, string modelCode, string modelName, string strXML, MsgType msgType) { Record.WriteLogFunction("AddDoDask()modelCode||" + modelCode); EngineServicesBLL bll = new EngineServicesBLL(); bll.AddDoDask(companyID, orderID, systemCode, modelCode, modelName, strXML, msgType); }
public void UnregisterHandler(MsgType msgType) { UnregisterHandler((short)msgType); }
public void Log(string data, MsgType msgType, bool isShown) { log_helper.DispProcess(data, msgType.ToString(), isShown); }
public void RegisterHandler(MsgType msgType, NetworkMessageDelegate handler) { RegisterHandler((short)msgType, handler); }
public static void UnregisterHandler(MsgType msgType) { UnregisterHandler((int)msgType); }
public Message(MsgType t) { type = t; }
public GameMsg(MsgType t, object c) { type = t; content = c; }
public List <UserInfo> ReturnUserInfoDask(string companyID, string orderID, string systemCode, string modelCode, string modelName, string strXML, MsgType msgType) { Record.WriteLogFunction("ReturnUserInfoDask()modelCode||" + modelCode); EngineServicesBLL bll = new EngineServicesBLL(); return(bll.ReturnUserInfoDask(companyID, orderID, systemCode, modelCode, modelName, strXML, msgType)); }
/// <summary> /// 写入新日志,根据指定的日志时间、日志内容和信息类型写入新日志 /// </summary> /// <param name="dt">日志时间</param> /// <param name="text">日志内容</param> /// <param name="type">信息类型</param> public void Write(DateTime dt, string text, MsgType type) { Write(new Msg(dt, text, type)); }
/// <summary> /// Decode KILE PDUs from received message bytes /// </summary> /// <param name="endPoint">An endpoint from which the message bytes are received</param> /// <param name="receivedBytes">The received bytes to be decoded</param> /// <param name="consumedLength">Length of message bytes consumed by decoder</param> /// <param name="expectedLength">Length of message bytes the decoder expects to receive</param> /// <returns>The decoded KILE PDUs</returns> /// <exception cref="System.FormatException">thrown when a kile message type is unsupported</exception> internal KilePdu[] DecodePacketCallback(object endPoint, byte[] receivedBytes, out int consumedLength, out int expectedLength) { // initialize lengths consumedLength = 0; expectedLength = 0; if (null == receivedBytes || 0 == receivedBytes.Length) { return(null); } if (!isClientRole) { serverContext = null; if (serverContextList != null) { var kileConnection = new KileConnection((IPEndPoint)endPoint); if (!serverContextList.ContainsKey(kileConnection)) { serverContext = new KileServerContext(); serverContext.TransportType = connectionType; serverContextList.Add(kileConnection, serverContext); } else { serverContext = serverContextList[kileConnection]; } } if (serverContext == null) { throw new InvalidOperationException("The kileConnection related context does not exist."); } } // TCP has a 4 bytes length header, while UDP has not byte[] pduBytes = receivedBytes; if ((isClientRole && clientContext.TransportType == KileConnectionType.TCP) || (!isClientRole && serverContext.TransportType == KileConnectionType.TCP)) { // insufficient data, needs to receive more if (receivedBytes.Length < sizeof(int)) { return(null); } // get pdu data length byte[] lengthBytes = ArrayUtility.SubArray(receivedBytes, 0, sizeof(int)); Array.Reverse(lengthBytes); int pduLength = BitConverter.ToInt32(lengthBytes, 0); // insufficient data, needs to receive more expectedLength = sizeof(int) + pduLength; if (receivedBytes.Length < expectedLength) { return(null); } // check if it is a krb zero message if (pduLength == 0 && receivedBytes.Length == sizeof(int)) { consumedLength = sizeof(int); var krbZeroPdu = new KrbZero(clientContext); return(new KilePdu[] { krbZeroPdu }); } // remove length header from pdu bytes pduBytes = ArrayUtility.SubArray <byte>(receivedBytes, sizeof(int), pduLength); } else { // UDP has no length header expectedLength = pduBytes.Length; } // get message type // (the lower 5 bits indicates its kile message type) MsgType kileMessageType = (MsgType)(pduBytes[0] & 0x1f); // decode according to message type consumedLength = expectedLength; KilePdu pdu = null; switch (kileMessageType) { case MsgType.KRB_AS_REQ: pdu = new KileAsRequest(serverContext); break; case MsgType.KRB_AS_RESP: pdu = new KileAsResponse(clientContext); break; case MsgType.KRB_TGS_REQ: pdu = new KileTgsRequest(serverContext); break; case MsgType.KRB_TGS_RESP: pdu = new KileTgsResponse(clientContext); break; case MsgType.KRB_ERROR: pdu = new KileKrbError(); break; default: throw new FormatException( "Unsupported Message Type: " + kileMessageType.ToString()); } pdu.FromBytes(pduBytes); // update context if (isClientRole) { clientContext.UpdateContext(pdu); } else { serverContext.UpdateContext(pdu); } return(new KilePdu[] { pdu }); }
public MsgInfo(MsgType type) { Success = true; Type = type; }
/// <summary> /// Sends pre-defined message to client. /// </summary> /// <param name="conn"></param> /// <param name="msgType"></param> public static void BC_MESSAGE(LoginConnection conn, MsgType msgType) => BC_MESSAGE(conn, msgType, null);
/// <summary> /// 发送待办(李国艺要求可以同一张单可以发送给多个人) /// </summary> /// <param name="UserAndForm">接收用户与FormID</param> /// <param name="SystemCode">系统代号</param> /// <param name="ModelCode">模块代号</param> /// <param name="strXml">业务数据XML<</param> /// <param name="msgType">消息类型</param> public void ApplicationMsgTriggerNew(List <CustomUserMsg> UserAndForm, string companyID, string SystemCode, string ModelCode, string strXml, MsgType msgType) { EngineServicesBLL bll = new EngineServicesBLL(); bll.ApplicationMsgTriggerNew(UserAndForm, companyID, SystemCode, ModelCode, strXml, msgType); }
/// <summary> /// 写入新日志,根据指定的异常类和信息类型写入新日志 /// </summary> /// <param name="e">异常对象</param> /// <param name="type">信息类型</param> public void Write(Exception e, MsgType type) { Write(new Msg(e.Message, type)); }
public NetMessage(MsgType _ID) { m_ID = _ID; }
/// <summary> /// Gets a value indicating whether or not the given <paramref name="msgType"/> is a server message. /// </summary> /// <param name="msgType">A <see cref="MsgType"/> value.</param> /// <returns>True if <paramref name="msgType"/> is a server message; otherwise, false.</returns> public static bool IsServer(MsgType msgType) { return((msgType & MsgType.Server) == MsgType.Server); }
public static extern RetCode Unsubscribe(MsgType msgType, string codeList);
/// <summary> /// Gets a value indicating whether or not the given <paramref name="msgType"/> is a client message. /// </summary> /// <param name="msgType">A <see cref="MsgType"/> value.</param> /// <returns>True if <paramref name="msgType"/> is a client message; otherwise, false.</returns> public static bool IsClient(MsgType msgType) { return((msgType & MsgType.Client) == MsgType.Client); }
public void SendMessage(MsgType msgType, Conditions data) { DataResponsible.SendMsg(msgType, data); }
//Get the expected Kerberos PDU from byte array private KerberosPdu getExpectedPduFromBytes( byte[] receivedBytes, out int consumedLength, out int expectedLength) { // initialize lengths consumedLength = 0; expectedLength = 0; if (null == receivedBytes || 0 == receivedBytes.Length) { return(null); } // TCP has a 4 bytes length header, while UDP has not byte[] pduBytes = receivedBytes; if ((this.Context.TransportType == TransportType.TCP)) { // insufficient data, needs to receive more if (receivedBytes.Length < sizeof(int)) { return(null); } // get pdu data length byte[] lengthBytes = ArrayUtility.SubArray(receivedBytes, 0, sizeof(int)); Array.Reverse(lengthBytes); int pduLength = BitConverter.ToInt32(lengthBytes, 0); // insufficient data, needs to receive more expectedLength = sizeof(int) + pduLength; if (receivedBytes.Length < expectedLength) { return(null); } // remove length header from pdu bytes pduBytes = ArrayUtility.SubArray <byte>(receivedBytes, sizeof(int), pduLength); } else { // UDP has no length header expectedLength = pduBytes.Length; } consumedLength = expectedLength; KerberosPdu pdu = null; //Get AP data in message to judge the kpassword type byte[] apLengthBytes = ArrayUtility.SubArray <byte>(pduBytes, 2 * sizeof(ushort), sizeof(ushort)); Array.Reverse(apLengthBytes); ushort apLength = BitConverter.ToUInt16(apLengthBytes, 0); //If the length is zero, then the last field contains a KRB-ERROR message instead of a KRB-PRIV message. if (apLength == 0) { pdu = new KerberosKrbError(); pdu.FromBytes(ArrayUtility.SubArray <byte>(pduBytes, 3 * sizeof(ushort))); return(pdu); } // get message type // (the lower 5 bits indicates its message type) byte[] apBytes = ArrayUtility.SubArray <byte>(pduBytes, 3 * sizeof(ushort), apLength); MsgType kpassMsgType = (MsgType)(apBytes[0] & 0x1f); if (kpassMsgType == MsgType.KRB_AP_REQ) { pdu = new KpasswordRequest(); } else { pdu = new KpasswordResponse(); pdu.FromBytes(pduBytes); } return(pdu); }
/// <summary> /// Formats and then writes a line to the console /// </summary> /// <param name="msg"></param> /// <param name="type"></param> public void WriteLine(string msg, MsgType type = MsgType.Info) { // create a prefix string string prefix = ""; string module = ""; // create a time string string time = $"[{DateTime.Now.ToString("HH:mm:ss")}] "; Color prefixColor = Color.White; Color moduleColor = Color.White; Color clientModuleColor = Color.CornflowerBlue; Color serverModuleColor = Color.MediumPurple; // determine what prefix and color is needed switch (type) { case MsgType.Info: moduleColor = clientModuleColor; prefixColor = Color.White; prefix = "INFO: "; module = "CLIENT: "; break; case MsgType.Warning: moduleColor = clientModuleColor; prefixColor = Color.Gold; prefix = "WARNING: "; module = "CLIENT: "; break; case MsgType.Failed: moduleColor = clientModuleColor; prefixColor = Color.Red; prefix = "FAILED: "; module = "CLIENT: "; break; case MsgType.Done: moduleColor = clientModuleColor; prefixColor = Color.Green; prefix = "DONE: "; module = "CLIENT: "; break; case MsgType.Input: moduleColor = clientModuleColor; prefixColor = Color.LightGray; prefix = "> "; module = ""; break; case MsgType.Debug: moduleColor = clientModuleColor; prefixColor = Color.Purple; prefix = "DEBUG: "; module = "CLIENT: "; break; case MsgType.Return: moduleColor = Color.White; prefixColor = Color.White; prefix = ""; module = ""; break; case MsgType.ServerInfo: moduleColor = serverModuleColor; prefixColor = Color.White; prefix = "INFO: "; module = "SERVER: "; break; case MsgType.ServerWarning: moduleColor = serverModuleColor; prefixColor = Color.Yellow; prefix = "WARNING: "; module = "SERVER: "; break; case MsgType.ServerFailed: moduleColor = serverModuleColor; prefixColor = Color.Red; prefix = "FAILED: "; module = "SERVER: "; break; case MsgType.ServerDone: moduleColor = serverModuleColor; prefixColor = Color.Green; prefix = "DONE: "; module = "SERVER: "; break; default: break; } // write the fully formatted string to console string[] msgSplit = msg.Split('\n'); foreach (string s in msgSplit) { string final = $"{time}{module}{prefix}{s}"; Lines.Add(final); Console.Out.WriteLine(final); OnLineWritten(new TextLogLineEventArgs(new RichText(new RichTextSection(time, Color.LightGray), new RichTextSection(module, moduleColor), new RichTextSection(prefix, prefixColor), new RichTextSection(s, Color.Lerp(Color.White, prefixColor, 0.8f))))); } }
/// <summary> /// 创建新的日志记录实例;日志事件为当前时间 /// </summary> /// <param name="t">日志记录的文本内容</param> /// <param name="p">日志记录的消息类型</param> public Msg(string t, MsgType p) : this(DateTime.Now, t, p) { }