private async Task ReadGuildCardDataFromServer() { if (Logger.IsDebugEnabled) { Logger.Debug("Sending GuildData request."); } CharacterGuildCardDataHeaderResponsePayload payload = await SendService.SendRequestAsync <CharacterGuildCardDataHeaderResponsePayload>(new CharacterGuildHeaderRequestPayload()); if (Logger.IsDebugEnabled) { Logger.Debug($"Guild Data Size: {payload.Length}."); } //TODO: Validate length //At this point we have recieved a guildcard data header. //This header contains information needed to async read all the guild card data from the server byte[] guildcardDataBytes = new byte[payload.Length]; //With the header we know how many bytes we should read for (uint chunkNumber = 0, byteReadCount = 0; byteReadCount < payload.Length; chunkNumber++) { //TODO: Should continue ever be false? CharacterGuildCardChunkResponsePayload response = await SendService.SendRequestAsync <CharacterGuildCardChunkResponsePayload>(new CharacterGuildCardChunkRequestPayload(chunkNumber, true)); if (Logger.IsDebugEnabled) { Logger.Debug($"Recieved Chunk: {response.ChunkNumber} Size: {response.PartialData.Length}."); } //Read the bytes into the created buffer Buffer.BlockCopy(response.PartialData, 0, guildcardDataBytes, (int)byteReadCount, response.PartialData.Length); byteReadCount += (uint)response.PartialData.Length; } if (Logger.IsDebugEnabled) { Logger.Debug($"Finished guild card data. Sending final ack."); } //At this point we've read all bytes async from the server for guild card data. //However the client also sends a final chunk request with a cont of 0 await PayloadSendService.SendMessage(new CharacterGuildCardChunkRequestPayload(0, false)); await Task.Delay(500); //enough time for server to see. }
private async Task DoChecksumProcess() { //Syl doesn't check value, so I don't know what to send. CharacterChecksumResponsePayload payload = await SendService.SendRequestAsync <CharacterChecksumResponsePayload>(new CharacterChecksumRequestPayload(0)); }