private ClientRequest CreateClientRequest(int type, int sys, byte[] bs, ulong route) { ClientRequest request = new ClientRequest(); byte[] dst = new byte[bs.Length + 2]; dst[0] = (byte)(type & 0xff); dst[1] = (byte)((type & 0xff00) >> 8); Buffer.BlockCopy(bs, 0, dst, 2, bs.Length); request.AddAttribute(ProtocolHelper.CreateAttribute("p", dst)); if (BattleNet.IsVersionInt()) { request.AddAttribute(ProtocolHelper.CreateAttribute("v", (long)((10 * BattleNet.GetVersionInt()) + sys))); } else { request.AddAttribute(ProtocolHelper.CreateAttribute("v", BattleNet.GetVersionString() + ((sys != 0) ? "b" : "c"))); } if (route != 0) { request.AddAttribute(ProtocolHelper.CreateAttribute("r", route)); } return(request); }
private ClientRequest CreateClientRequest(int type, int sys, byte[] bs, ulong route) { ClientRequest clientRequest = new ClientRequest(); clientRequest.AddAttribute(ProtocolHelper.CreateAttribute("p", bs)); if (!BattleNet.IsVersionInt()) { clientRequest.AddAttribute(ProtocolHelper.CreateAttribute("v", BattleNet.GetVersion() + ((sys != 0) ? "b" : "c"))); } else { int num = 0; if (!int.TryParse(BattleNet.GetVersion(), out num)) { LogAdapter.Log(LogLevel.Error, "Could not convert BattleNetVersion to int: " + BattleNet.GetVersion()); } clientRequest.AddAttribute(ProtocolHelper.CreateAttribute("v", (long)(10 * num + sys))); } if (route != 0UL) { clientRequest.AddAttribute(ProtocolHelper.CreateAttribute("r", route)); } return(clientRequest); }