public bool NetHandle_FrameData_Material(eNetCmd cmd, UsCmd c) { UsLogging.Printf("eNetCmd.Handle_FrameData_Material received ({0}).", c.Buffer.Length); var materials = new ObservableCollection <MaterialObject>(); int count = c.ReadInt32(); for (int i = 0; i < count; i++) { var m = new MaterialObject(); m.InstID = c.ReadInt32(); m.Name = c.ReadString(); m.ShaderName = c.ReadString(); m.RefCnt = c.ReadInt32(); m.RefList = new List <int>(); for (int k = 0; k < m.RefCnt; k++) { int owner = c.ReadInt32(); m.RefList.Add(owner); } materials.Add(m); } MaterialGrid.Dispatcher.Invoke(new Action(() => { title_material.Text = string.Format("Materials ({0})", materials.Count); MaterialGrid.DataContext = materials; })); return(true); }
public bool NetHandle_FrameData_Texture(eNetCmd cmd, UsCmd c) { UsLogging.Printf("eNetCmd.Handle_FrameData_Texture received ({0}).", c.Buffer.Length); var textures = new ObservableCollection <TextureObject>(); int count = c.ReadInt32(); for (int i = 0; i < count; i++) { var m = new TextureObject(); m.InstID = c.ReadInt32(); m.Name = c.ReadString(); m.PixelSize = c.ReadString(); m.MemSize = c.ReadString(); m.RefCnt = c.ReadInt32(); m.RefList = new List <int>(); for (int k = 0; k < m.RefCnt; k++) { int owner = c.ReadInt32(); m.RefList.Add(owner); } textures.Add(m); } TextureGrid.Dispatcher.Invoke(new Action(() => { title_texture.Text = string.Format("Textures ({0})", textures.Count); TextureGrid.DataContext = textures; })); return(true); }
private bool NetHandle_ExecCommand(string clientID, eNetCmd cmd, UsCmd c) { string read = c.ReadString(); string[] fragments = read.Split(); if (fragments.Length == 0) { Log.Info("empty command received, ignored."); return(false); } UsvClientConsoleCmdHandler handler; if (!_clientConsoleCmdHandlers.TryGetValue(fragments[0].ToLower(), out handler)) { Log.Info("unknown command ('{0}') received, ignored.", read); return(false); } bool succ = handler(clientID, fragments); UsCmd reply = new UsCmd(); reply.WriteNetCmd(eNetCmd.SV_ExecCommandResponse); reply.WriteInt32(succ ? 1 : 0); SendCommand(clientID, reply); return(true); }
public UsLogPacket(UsCmd c) { SeqID = (ushort)c.ReadInt16(); LogType = (UsLogType)c.ReadInt32(); Content = c.ReadString(); RealtimeSinceStartup = c.ReadFloat(); }
private bool NetHandle_ExecCommand(string clientID, eNetCmd cmd, UsCmd c) { string str = c.ReadString(); string[] args = str.Split((char[])Array.Empty <char>()); if (args.Length == 0) { Log.Info((object)"empty command received, ignored.", (object[])Array.Empty <object>()); return(false); } UsvClientConsoleCmdHandler consoleCmdHandler; if (!this._clientConsoleCmdHandlers.TryGetValue(args[0].ToLower(), out consoleCmdHandler)) { Log.Info((object)"unknown command ('{0}') received, ignored.", (object)str); return(false); } bool flag = consoleCmdHandler(clientID, args); UsCmd cmd1 = new UsCmd(); cmd1.WriteNetCmd(eNetCmd.SV_ExecCommandResponse); cmd1.WriteInt32(!flag ? 0 : 1); this.SendCommand(clientID, cmd1); return(true); }
public bool NetHandle_FrameDataV2_Names(eNetCmd cmd, UsCmd c) { MeshGrid.Dispatcher.Invoke(new Action(() => { int count = c.ReadInt32(); UsLogging.Printf("eNetCmd.NetHandle_FrameDataV2_Names [b]({0} got)[/b].", count); for (int i = 0; i < count; i++) { int instID = c.ReadInt32(); string instName = c.ReadString(); foreach (var item in MeshGrid.Items) { MeshObject mo = item as MeshObject; if (mo != null && mo.InstID == instID) { mo.Name = instName; } } } MeshGrid.Items.Refresh(); })); return(true); }
public UsLogPacket(UsCmd c) { SeqID = (ushort)c.ReadInt16(); LogType = (UsLogType)c.ReadInt32(); Content = c.ReadString(); RealtimeSinceStartup = c.ReadFloat(); }
bool NetHandle_QuerySwitchesResponse(eNetCmd cmd, UsCmd c) { int count = c.ReadInt32(); for (int i = 0; i < count; i++) { string name = c.ReadString(); string path = c.ReadString(); short initVal = c.ReadInt16(); _switchersPanel.Dispatcher.Invoke(new Action(() => { AddSwitcher(name, path, initVal != 0); })); } return true; }
private bool Handle_ExecCommandResponse(eNetCmd cmd, UsCmd c) { string ret = c.ReadString(); UsLogging.Printf(string.Format("command executing result: [b]{0}[/b]", ret)); return(true); }
bool NetHandle_QuerySwitchesResponse(eNetCmd cmd, UsCmd c) { int count = c.ReadInt32(); for (int i = 0; i < count; i++) { string name = c.ReadString(); string path = c.ReadString(); short initVal = c.ReadInt16(); _switchersPanel.Dispatcher.Invoke(new Action(() => { AddSwitcher(name, path, initVal != 0); })); } return(true); }
public bool NetHandle_SendLuaProfilerMsg(eNetCmd cmd, UsCmd c) { string data = c.ReadString(); if (!string.IsNullOrEmpty(data)) { sessionMsgList.Add(data); } return(true); }
private bool NetHandle_ExecCommand(eNetCmd cmd, UsCmd c) { string read = c.ReadString(); UsCmd reply = new UsCmd(); reply.WriteNetCmd(eNetCmd.SV_ExecCommandResponse); reply.WriteString(string.Format("str: {0}, len: {1}", read, read.Length)); UsNet.Instance.SendCommand(reply); return(true); }
bool NetHandle_StartAnalysePixels(eNetCmd cmd, UsCmd c) { int count = c.ReadInt32(); for (int i = 0; i < count; ++i ) { string msg = c.ReadString(); UsLogging.Printf(msg); } return true; }
private bool NetHandle_ExecCommand(eNetCmd cmd, UsCmd c) { string fullcmd = c.ReadString(); bool flag = UsvConsole.Instance.ExecuteCommand(fullcmd); UsCmd cmd1 = new UsCmd(); cmd1.WriteNetCmd(eNetCmd.SV_ExecCommandResponse); cmd1.WriteInt32(!flag ? 0 : 1); UsNet.Instance.SendCommand(cmd1); return(true); }
bool NetHandle_StartAnalysePixels(eNetCmd cmd, UsCmd c) { int count = c.ReadInt32(); for (int i = 0; i < count; ++i) { string msg = c.ReadString(); UsLogging.Printf(msg); } return(true); }
private bool NetHandle_ExecCommand(eNetCmd cmd, UsCmd c) { string read = c.ReadString(); bool ret = UsvConsole.Instance.ExecuteCommand(read); UsCmd reply = new UsCmd(); reply.WriteNetCmd(eNetCmd.SV_ExecCommandResponse); reply.WriteInt32 (ret ? 1 : 0); UsNet.Instance.SendCommand(reply); return true; }
private bool NetHandle_ExecCommand(eNetCmd cmd, UsCmd c) { string read = c.ReadString(); bool ret = UsvConsole.Instance.ExecuteCommand(read); UsCmd reply = new UsCmd(); reply.WriteNetCmd(eNetCmd.SV_ExecCommandResponse); reply.WriteInt32(ret ? 1 : 0); UsNet.Instance.SendCommand(reply); return(true); }
public bool Handle_VarTracerJsonParameter(eNetCmd cmd, UsCmd c) { var varTracerInfo = c.ReadString(); if (string.IsNullOrEmpty(varTracerInfo)) { return(false); } lock (_locker) VarTracerNet.Instance.VartracerJsonMsgList.Add(varTracerInfo); //NetUtil.Log("varTracer info{0}", varTracerInfo); return(true); }
private bool Handle_QueryStacksResponse(eNetCmd cmd, UsCmd c) { var stackInfo = c.ReadString(); if (string.IsNullOrEmpty(stackInfo)) { return(false); } _stackInfoObj.writeStackInfo(stackInfo); NetUtil.Log("stack info{0}", stackInfo); return(true); }
bool NetHandle_StressTestNames(eNetCmd cmd, UsCmd c) { var effects = new ObservableCollection <EffectObject>(); int count = c.ReadInt32(); for (int i = 0; i < count; i++) { var e = new EffectObject(); e.Name = c.ReadString(); effects.Add(e); } EffectGrid.Dispatcher.Invoke(new Action(() => { EffectGrid.DataContext = effects; })); return(true); }
bool NetHandle_QuerySlidersResponse(eNetCmd cmd, UsCmd c) { int count = c.ReadInt32(); for (int i = 0; i < count; i++) { string name = c.ReadString(); float minVal = c.ReadFloat(); float maxVal = c.ReadFloat(); float initVal = c.ReadFloat(); _slidersPanel.Dispatcher.Invoke(new Action(() => { AddSlider(name, minVal, maxVal, initVal); })); } return true; }
bool NetHandle_QuerySlidersResponse(eNetCmd cmd, UsCmd c) { int count = c.ReadInt32(); for (int i = 0; i < count; i++) { string name = c.ReadString(); float minVal = c.ReadFloat(); float maxVal = c.ReadFloat(); float initVal = c.ReadFloat(); _slidersPanel.Dispatcher.Invoke(new Action(() => { AddSlider(name, minVal, maxVal, initVal); })); } return(true); }
public bool NetHandle_RequestStackData(eNetCmd cmd, UsCmd c) { int instID = c.ReadInt32(); string str = c.ReadString(); Debug.Log((object)string.Format("NetHandle_RequestStackData instanceID={0} className={1}", (object)instID, (object)str)); ResourceRequestInfo allocInfo = ResourceTracker.Instance.GetAllocInfo(instID); UsCmd cmd1 = new UsCmd(); cmd1.WriteNetCmd(eNetCmd.SV_QueryStacksResponse); if (allocInfo == null) { cmd1.WriteString("<no_callstack_available>"); } else { cmd1.WriteString(ResourceTracker.Instance.GetStackTrace(allocInfo)); } UsNet.Instance.SendCommand(cmd1); return(true); }
public bool NetHandle_RequestStackData(eNetCmd cmd, UsCmd c) { int instanceID = c.ReadInt32(); string className = c.ReadString(); UnityEngine.Debug.Log(string.Format("NetHandle_RequestStackData instanceID={0} className={1}", instanceID, className)); ResourceRequestInfo requestInfo = ResourceTracker.Instance.GetAllocInfo(instanceID); UsCmd pkt = new UsCmd(); pkt.WriteNetCmd(eNetCmd.SV_QueryStacksResponse); if (requestInfo == null) { pkt.WriteString("<no_callstack_available>"); } else { pkt.WriteString(ResourceTracker.Instance.GetStackTrace(requestInfo)); } UsNet.Instance.SendCommand(pkt); return(true); }
bool NetHandle_StressTestResult(eNetCmd cmd, UsCmd c) { string name = c.ReadString(); int avgMS = c.ReadInt32(); int maxMS = c.ReadInt32(); int drawcall = c.ReadInt32(); int parCount = c.ReadInt32(); EffectGrid.Dispatcher.Invoke(new Action(() => { foreach (var item in EffectGrid.Items) { EffectObject mo = item as EffectObject; if (mo != null && mo.Name == name) { if (_highlighted != null) { DataGridUtil.ClearHighlighted(EffectGrid, _highlighted); } mo.MSAvg = avgMS; mo.MSMax = maxMS; mo.DrawCallCount = drawcall; mo.TotalParticles = parCount; DataGridUtil.MarkAsHighlighted(EffectGrid, item, Colors.Chartreuse); _highlighted = mo; break; } } })); RunNextEffectStressTest(); return(true); }
public bool NetHandle_RequestStackSummary(eNetCmd cmd, UsCmd c) { string flag = c.ReadString(); if (string.IsNullOrEmpty(flag)) { return(false); } if (flag.Equals("begin")) { _stackUnavailableDict.Clear(); return(true); } if (flag.Equals("end")) { UnityEngine.Debug.Log("Stack Category Statistical Information:"); //NetUtil.Log("堆栈类型统计信息:"); int totalCount = 0; int unavailableTotalCount = 0; int totalSize = 0; int unavailableTotalSize = 0; int categoryCount = c.ReadInt32(); for (int i = 0; i < categoryCount; i++) { string category = c.ReadString(); List <stackParamater> unavailableList; _stackUnavailableDict.TryGetValue(category, out unavailableList); if (unavailableList != null) { int CategoryCount = c.ReadInt32(); int CategorySize = c.ReadInt32(); totalCount += CategoryCount; totalSize += CategorySize; unavailableTotalCount += unavailableList.Count; int categoryTotalSize = 0; foreach (var info in unavailableList) { categoryTotalSize += info.Size; } unavailableTotalSize += categoryTotalSize; UnityEngine.Debug.Log(string.Format("[{0} =({1}/{2},{3}/{4})]", category, unavailableList.Count, CategoryCount, ResourceTrackerConst.FormatBytes(categoryTotalSize), ResourceTrackerConst.FormatBytes(CategorySize))); //NetUtil.Log("【{0} =({1}/{2},{3}/{4})】", category, unavailableList.Count, CategoryCount, ResourceTrackerConst.FormatBytes(categoryTotalSize), ResourceTrackerConst.FormatBytes(CategorySize)); } } UnityEngine.Debug.Log(string.Format("[total =({0}/{1},{2}/{3})]", unavailableTotalCount, totalCount, ResourceTrackerConst.FormatBytes(unavailableTotalSize), ResourceTrackerConst.FormatBytes(totalSize))); //NetUtil.Log("【total =({0}/{1},{2}/{3})】", unavailableTotalCount, totalCount, ResourceTrackerConst.FormatBytes(unavailableTotalSize), ResourceTrackerConst.FormatBytes(totalSize)); return(true); } string className = flag; int count = c.ReadInt32(); for (int i = 0; i < count; i++) { int instanceID = c.ReadInt32(); int size = c.ReadInt32(); ResourceRequestInfo requestInfo = ResourceTracker.Instance.GetAllocInfo(instanceID); if (requestInfo == null) { if (!_stackUnavailableDict.ContainsKey(className)) { _stackUnavailableDict.Add(className, new List <stackParamater>()); } List <stackParamater> stackUnavailableList; _stackUnavailableDict.TryGetValue(className, out stackUnavailableList); stackParamater info = new stackParamater(); info.InstanceID = instanceID; info.Size = size; stackUnavailableList.Add(info); } } return(true); }
private bool NetHandle_FrameData_Mesh(eNetCmd cmd, UsCmd c) { short subCmd = c.ReadInt16(); switch ((eSubCmd_TransmitStage)subCmd) { case eSubCmd_TransmitStage.DataBegin: { MeshGrid.Dispatcher.Invoke(new Action(() => { if (_meshes == null) { _meshes = new ObservableCollection <MeshObject>(); } else { _meshes.Clear(); } _meshExpectedCount = c.ReadInt32(); UsLogging.Printf("eNetCmd.NetHandle_FrameData_Mesh [b](DataBegin)[/b] ({0}).", _meshExpectedCount); })); } break; case eSubCmd_TransmitStage.DataSlice: { int count = c.ReadInt32(); UsLogging.Printf("eNetCmd.NetHandle_FrameData_Mesh [b](DataSlice)[/b] ({0}).", count); if (count > 0) { MeshGrid.Dispatcher.Invoke(new Action(() => { for (int i = 0; i < count; i++) { var m = new MeshObject(); m.InstID = c.ReadInt32(); m.Name = c.ReadString(); m.VertCnt = c.ReadInt32(); m.MatCnt = c.ReadInt32(); m.Size = (float)c.ReadFloat(); _meshes.Add(m); } })); } } break; case eSubCmd_TransmitStage.DataEnd: { UsLogging.Printf("eNetCmd.NetHandle_FrameData_Mesh [b](DataEnd)[/b] (expected: {0} actual: {1}).", _meshExpectedCount, _meshes.Count); if (_meshExpectedCount != _meshes.Count) { UsLogging.Printf(LogWndOpt.Bold, "The actually received mesh count is mismatched with expected."); } MeshGrid.Dispatcher.Invoke(new Action(() => { title_mesh.Text = string.Format("Meshes ({0})", _meshes.Count); MeshGrid.DataContext = _meshes; })); } break; default: break; } return(true); }
public bool NetHandle_FrameData_Texture(eNetCmd cmd, UsCmd c) { UsLogging.Printf("eNetCmd.Handle_FrameData_Texture received ({0}).", c.Buffer.Length); var textures = new ObservableCollection<TextureObject>(); int count = c.ReadInt32(); for (int i = 0; i < count; i++) { var m = new TextureObject(); m.InstID = c.ReadInt32(); m.Name = c.ReadString(); m.PixelSize = c.ReadString(); m.MemSize = c.ReadString(); m.RefCnt = c.ReadInt32(); m.RefList = new List<int>(); for (int k = 0; k < m.RefCnt; k++) { int owner = c.ReadInt32(); m.RefList.Add(owner); } textures.Add(m); } TextureGrid.Dispatcher.Invoke(new Action(() => { title_texture.Text = string.Format("Textures ({0})", textures.Count); TextureGrid.DataContext = textures; })); return true; }
public bool NetHandle_FrameData_Material(eNetCmd cmd, UsCmd c) { UsLogging.Printf("eNetCmd.Handle_FrameData_Material received ({0}).", c.Buffer.Length); var materials = new ObservableCollection<MaterialObject>(); int count = c.ReadInt32(); for (int i = 0; i < count; i++) { var m = new MaterialObject(); m.InstID = c.ReadInt32(); m.Name = c.ReadString(); m.ShaderName = c.ReadString(); m.RefCnt = c.ReadInt32(); m.RefList = new List<int>(); for (int k = 0; k < m.RefCnt; k++) { int owner = c.ReadInt32(); m.RefList.Add(owner); } materials.Add(m); } MaterialGrid.Dispatcher.Invoke(new Action(() => { title_material.Text = string.Format("Materials ({0})", materials.Count); MaterialGrid.DataContext = materials; })); return true; }
public bool NetHandle_RequestStackSummary(eNetCmd cmd, UsCmd c) { string str = c.ReadString(); if (string.IsNullOrEmpty(str)) { return(false); } if (str.Equals("begin")) { this._stackUnavailableDict.Clear(); return(true); } if (str.Equals("end")) { Debug.Log((object)"Stack Category Statistical Information:"); int num1 = 0; int num2 = 0; int bytes1 = 0; int bytes2 = 0; int num3 = c.ReadInt32(); for (int index = 0; index < num3; ++index) { string key = c.ReadString(); List <ResourceTracker.stackParamater> stackParamaterList; this._stackUnavailableDict.TryGetValue(key, out stackParamaterList); if (stackParamaterList != null) { int num4 = c.ReadInt32(); int bytes3 = c.ReadInt32(); num1 += num4; bytes1 += bytes3; num2 += stackParamaterList.Count; int bytes4 = 0; foreach (ResourceTracker.stackParamater stackParamater in stackParamaterList) { bytes4 += stackParamater.Size; } bytes2 += bytes4; Debug.Log((object)string.Format("[{0} =({1}/{2},{3}/{4})]", (object)key, (object)stackParamaterList.Count, (object)num4, (object)ResourceTrackerConst.FormatBytes(bytes4), (object)ResourceTrackerConst.FormatBytes(bytes3))); } } Debug.Log((object)string.Format("[total =({0}/{1},{2}/{3})]", (object)num2, (object)num1, (object)ResourceTrackerConst.FormatBytes(bytes2), (object)ResourceTrackerConst.FormatBytes(bytes1))); return(true); } string key1 = str; int num5 = c.ReadInt32(); for (int index = 0; index < num5; ++index) { int instID = c.ReadInt32(); int num1 = c.ReadInt32(); if (ResourceTracker.Instance.GetAllocInfo(instID) == null) { if (!this._stackUnavailableDict.ContainsKey(key1)) { this._stackUnavailableDict.Add(key1, new List <ResourceTracker.stackParamater>()); } List <ResourceTracker.stackParamater> stackParamaterList; this._stackUnavailableDict.TryGetValue(key1, out stackParamaterList); stackParamaterList.Add(new ResourceTracker.stackParamater() { InstanceID = instID, Size = num1 }); } } return(true); }
bool NetHandle_StressTestResult(eNetCmd cmd, UsCmd c) { string name = c.ReadString(); int avgMS = c.ReadInt32(); int maxMS = c.ReadInt32(); int drawcall = c.ReadInt32(); int parCount = c.ReadInt32(); EffectGrid.Dispatcher.Invoke(new Action(() => { foreach (var item in EffectGrid.Items) { EffectObject mo = item as EffectObject; if (mo != null && mo.Name == name) { if (_highlighted != null) { DataGridUtil.ClearHighlighted(EffectGrid, _highlighted); } mo.MSAvg = avgMS; mo.MSMax = maxMS; mo.DrawCallCount = drawcall; mo.TotalParticles = parCount; DataGridUtil.MarkAsHighlighted(EffectGrid, item, Colors.Chartreuse); _highlighted = mo; break; } } })); RunNextEffectStressTest(); return true; }
bool NetHandle_StressTestNames(eNetCmd cmd, UsCmd c) { var effects = new ObservableCollection<EffectObject>(); int count = c.ReadInt32(); for (int i = 0; i < count; i++) { var e = new EffectObject(); e.Name = c.ReadString(); effects.Add(e); } EffectGrid.Dispatcher.Invoke(new Action(() => { EffectGrid.DataContext = effects; })); return true; }
public bool NetHandle_FrameDataV2_Names(eNetCmd cmd, UsCmd c) { MeshGrid.Dispatcher.Invoke(new Action(() => { int count = c.ReadInt32(); UsLogging.Printf("eNetCmd.NetHandle_FrameDataV2_Names [b]({0} got)[/b].", count); for (int i = 0; i < count; i++) { int instID = c.ReadInt32(); string instName = c.ReadString(); foreach (var item in MeshGrid.Items) { MeshObject mo = item as MeshObject; if (mo != null && mo.InstID == instID) { mo.Name = instName; } } } MeshGrid.Items.Refresh(); })); return true; }