public static uint ClientSend(IntPtr ptr, ref CDataStore dataStore, int args) { var ds = dataStore.Clone(); var pkt = new Packet(ds); PacketLog.Write(pkt, "ClientMessage"); Memory.Write(originalFunction, originalInstruction); var ret = (uint)originalDelegate.DynamicInvoke(new object[] { ptr, dataStore, args }); Memory.Write(originalFunction, hookInstruction); return (uint)ret; }
public static async void Write(Packet packet, string type) { Func<Task> write = async delegate { var sb = new StringBuilder(); sb.Append(string.Format("Time: {0};OpcodeType: {1};OpcodeValue: {2};Packet: ", packet.TimeStamp, type, packet.Message)); foreach (var b in packet.Data) sb.Append(string.Format("{0:X2}", b)); sb.Append(";"); await Task.Run(new Action(delegate() { logQueue.Add(sb.ToString()); })); }; await write(); }