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; }
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 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); }