//////////////// public static void SendToClient(int toWho, int ignoreWho) { var myworld = ModContent.GetInstance <BetterPaintWorld>(); string json = JsonConvert.SerializeObject(myworld.Layers); int segSize = (64 * 1024) - 1; IList <string> segs = new List <string>(); for (int i = 0; i < json.Length; i += segSize) { int len = Math.Min(segSize, json.Length - i); string seg = json.Substring(i, len); segs.Add(seg); } for (int i = 0; i < segs.Count; i++) { WorldPaintDataSegmentProtocol.Send(WorldPaintDataProtocol.CurrentPacketSetId, segs[i], i, segs.Count, toWho, ignoreWho); } WorldPaintDataProtocol.CurrentPacketSetId++; }
public static void Send(int packetSetId, string jsonSeg, int jsonSegNum, int jsonSegMax, int toWho, int ignoreWho) { var protocol = new WorldPaintDataSegmentProtocol(packetSetId, jsonSeg, jsonSegNum, jsonSegMax); protocol.SendToClient(toWho, ignoreWho); }