private void OnConnected(object sender, EventArgs e) { UsCmd cmd = new UsCmd(); cmd.WriteInt16((short)1001); cmd.WriteInt16((short)0); cmd.WriteInt16((short)1); cmd.WriteInt16((short)0); this._client.SendPacket(cmd); this._tickTimer.Start(); this._guardTimer.Activate(); }
private void OnConnected(object sender, EventArgs e) { UsCmd cmd = new UsCmd(); cmd.WriteInt16((short)eNetCmd.CL_Handshake); cmd.WriteInt16(UsConst.VersionMajor); cmd.WriteInt16(UsConst.VersionMinor); cmd.WriteInt16(UsConst.VersionPatch); _client.SendPacket(cmd); _tickTimer.Start(); _guardTimer.Activate(); }
public void StartLuaProfiler() { DirectoryInfo myDirectoryInfo = new DirectoryInfo(m_luaProfilerSessionsPath); if (!myDirectoryInfo.Exists) { Directory.CreateDirectory(m_luaProfilerSessionsPath); } string file = Path.Combine(m_luaProfilerSessionsPath, GetTimestamp() + ".json"); m_LuaSvr.luaState.getFunction("profiler_start").call(file); if (!LuaDLL.isregister_callback()) { LuaDLL.register_callback(OnMessage); } _networkAvailable = UsNet.Instance != null && UsNet.Instance.IsListening; if (_networkAvailable) { UsCmd cmd = new UsCmd(); cmd.WriteInt16((short)eNetCmd.SV_StartLuaProfilerMsg); UsNet.Instance.SendCommand(cmd); } }
public UsCmd CreatePacket() { UsCmd c = new UsCmd(); c.WriteNetCmd(eNetCmd.SV_App_Logging); c.WriteInt16((short)SeqID); c.WriteInt32((int)LogType); c.WriteStringStripped(Content, MAX_CONTENT_LEN); c.WriteFloat(RealtimeSinceStartup); return(c); }
public UsCmd CreatePacket() { UsCmd usCmd = new UsCmd(); usCmd.WriteNetCmd(eNetCmd.SV_App_Logging); usCmd.WriteInt16((short)this.SeqID); usCmd.WriteInt32((int)this.LogType); usCmd.WriteStringStripped(this.Content, (short)1024); usCmd.WriteFloat(this.RealtimeSinceStartup); return(usCmd); }
void LogTarget_Remotely(object sender, LogEventArgs args) { if (UsNet.Instance != null) { UsCmd c = new UsCmd(); c.WriteNetCmd(eNetCmd.SV_App_Logging); c.WriteInt16((short)args.SeqID); c.WriteInt32((int)args.LogType); c.WriteStringStripped(args.Content, MAX_CONTENT_LEN); c.WriteFloat(args.Time); UsNet.Instance.SendCommand(c); } }
private void requestStackDataInfo() { var selectNat = _selectedThing as NativeUnityEngineObject; if (selectNat == null) { return; } UsCmd cmd = new UsCmd(); cmd.WriteInt16((short)eNetCmd.CL_RequestStackData); cmd.WriteInt32(selectNat.instanceID); cmd.WriteString(getRemoveDiffTypeStr(selectNat)); NetManager.Instance.Send(cmd); }
private void LogTarget_Remotely(object sender, LogEventArgs args) { if (UsNet.Instance == null) { return; } UsCmd cmd = new UsCmd(); cmd.WriteNetCmd(eNetCmd.SV_App_Logging); cmd.WriteInt16((short)args.SeqID); cmd.WriteInt32((int)args.LogType); cmd.WriteStringStripped(args.Content, (short)1024); cmd.WriteFloat(args.Time); UsNet.Instance.SendCommand(cmd); }
private bool NetHandle_QuerySwitches(eNetCmd cmd, UsCmd c) { UsCmd cmd1 = new UsCmd(); cmd1.WriteNetCmd(eNetCmd.SV_QuerySwitchesResponse); cmd1.WriteInt32(GameInterface.ObjectNames.Count); foreach (KeyValuePair <string, string> objectName in GameInterface.ObjectNames) { cmd1.WriteString(objectName.Key); cmd1.WriteString(objectName.Value); cmd1.WriteInt16((short)1); } UsNet.Instance.SendCommand(cmd1); return(true); }
private bool NetHandle_QuerySwitches(eNetCmd cmd, UsCmd c) { UsCmd pkt = new UsCmd(); pkt.WriteNetCmd(eNetCmd.SV_QuerySwitchesResponse); pkt.WriteInt32(GameInterface.ObjectNames.Count); foreach (var name in GameInterface.ObjectNames) { //Log.Info("{0} {1} switch added.", name.Key, name.Value); pkt.WriteString(name.Key); pkt.WriteString(name.Value); pkt.WriteInt16(1); } UsNet.Instance.SendCommand(pkt); return(true); }
public static void OnMessage(string data) { Debug.Assert(Instance != null); if (Instance == null) { return; } Debug.Assert(!string.IsNullOrEmpty(data)); if (string.IsNullOrEmpty(data)) { return; } if (Instance._networkAvailable) { UsCmd cmd = new UsCmd(); cmd.WriteInt16((short)eNetCmd.SV_SendLuaProfilerMsg); cmd.WriteString(data); UsNet.Instance.SendCommand(cmd); } }
private void OnConnected(object sender, EventArgs e) { UsCmd cmd = new UsCmd(); cmd.WriteInt16((short)eNetCmd.CL_Handshake); cmd.WriteInt16(Properties.Settings.Default.VersionMajor); cmd.WriteInt16(Properties.Settings.Default.VersionMinor); cmd.WriteInt16(Properties.Settings.Default.VersionPatch); _client.SendPacket(cmd); _tickTimer.Start(); _guardTimer.Activate(); }
static void RequestStackSummary() { #if UNITY_EDITOR if (NetManager.Instance == null) { return; } MemoryProfilerWindow.MemoryProfilerWindow w = EditorWindow.GetWindow <MemoryProfilerWindow.MemoryProfilerWindow>("MemoryProfilerWindow"); if (w.GetType().Name == "MemoryProfilerWindow") { if (w.UnpackedCrawl == null) { return; } Dictionary <string, List <stackParamater> > categoryDict = new Dictionary <string, List <stackParamater> >(); foreach (var trackCategory in SceneGraphExtractor.MemCategories) { if (!categoryDict.ContainsKey(trackCategory)) { categoryDict.Add(trackCategory, new List <stackParamater>()); } } foreach (var obj in w.UnpackedCrawl.nativeObjects) { if (categoryDict.ContainsKey(obj.className)) { List <stackParamater> list; categoryDict.TryGetValue(obj.className, out list); var info = new stackParamater(); info.InstanceID = obj.instanceID; info.Size = obj.size; list.Add(info); } } UsCmd cmd = new UsCmd(); cmd.WriteInt16((short)eNetCmd.CL_RequestStackSummary); cmd.WriteString("begin"); NetManager.Instance.Send(cmd); int passCountPerCmd = 500; foreach (var categoryPair in categoryDict) { int count = categoryPair.Value.Count; int times = count / passCountPerCmd; int residue = count % passCountPerCmd; for (int i = 0; i < times; i++) { cmd = new UsCmd(); cmd.WriteInt16((short)eNetCmd.CL_RequestStackSummary); cmd.WriteString(categoryPair.Key); cmd.WriteInt32(passCountPerCmd); for (int j = i * passCountPerCmd; j < (i + 1) * passCountPerCmd; j++) { var info = categoryPair.Value[j]; cmd.WriteInt32(info.InstanceID); cmd.WriteInt32(info.Size); } NetManager.Instance.Send(cmd); } if (residue > 0) { cmd = new UsCmd(); cmd.WriteInt16((short)eNetCmd.CL_RequestStackSummary); cmd.WriteString(categoryPair.Key); cmd.WriteInt32(residue); for (int i = 0; i < residue; i++) { var info = categoryPair.Value[times * passCountPerCmd + i]; cmd.WriteInt32(info.InstanceID); cmd.WriteInt32(info.Size); } NetManager.Instance.Send(cmd); } } cmd = new UsCmd(); cmd.WriteInt16((short)eNetCmd.CL_RequestStackSummary); cmd.WriteString("end"); cmd.WriteInt32(categoryDict.Count); foreach (var categoryPair in categoryDict) { cmd.WriteString(categoryPair.Key); cmd.WriteInt32(categoryPair.Value.Count); int categoryTotalSize = 0; foreach (var info in categoryPair.Value) { categoryTotalSize += info.Size; } cmd.WriteInt32(categoryTotalSize); } NetManager.Instance.Send(cmd); } #endif }
public UsCmd CreatePacket() { UsCmd c = new UsCmd(); c.WriteNetCmd(eNetCmd.SV_App_Logging); c.WriteInt16((short)SeqID); c.WriteInt32((int)LogType); c.WriteStringStripped(Content, MAX_CONTENT_LEN); c.WriteFloat(RealtimeSinceStartup); return c; }
private bool NetHandle_QuerySwitches(eNetCmd cmd, UsCmd c) { UsCmd pkt = new UsCmd(); pkt.WriteNetCmd(eNetCmd.SV_QuerySwitchesResponse); pkt.WriteInt32(GameInterface.ObjectNames.Count); foreach (var name in GameInterface.ObjectNames) { //Log.Info("{0} {1} switch added.", name.Key, name.Value); pkt.WriteString(name.Key); pkt.WriteString(name.Value); pkt.WriteInt16(1); } UsNet.Instance.SendCommand(pkt); return true; }