private void InitDifferenceExecutor() { DifferenceExecutor = new RequestTask(async delegate { await session.Established; logger.info("get difference from state: pts {0}, qts {1}, date {2}", pts, qts, date); updates_Difference difference = await this.session.Api.updates_getDifference(pts, date, qts); while (difference.Constructor == Constructor.updates_differenceSlice || difference.Constructor == Constructor.updates_difference) { List <Message> new_messages; List <Update> other_updates; List <Chat> chats; List <User> users; Updates_stateConstructor state; logger.debug("processing difference: {0}", difference); if (difference.Constructor == Constructor.updates_difference) { Updates_differenceConstructor diff = (Updates_differenceConstructor)difference; new_messages = diff.new_messages; other_updates = diff.other_updates; chats = diff.chats; users = diff.users; state = (Updates_stateConstructor)diff.state; ProcessUpdatesDifference(new_messages, other_updates, chats, users, state); break; } else { Updates_differenceSliceConstructor diff = (Updates_differenceSliceConstructor)difference; new_messages = diff.new_messages; other_updates = diff.other_updates; chats = diff.chats; users = diff.users; state = (Updates_stateConstructor)diff.intermediate_state; ProcessUpdatesDifference(new_messages, other_updates, chats, users, state); difference = await this.session.Api.updates_getDifference(pts, date, qts); } } logger.info("get difference completed successfully"); }); }
public override void OnResponse(BinaryReader reader) { updatesDifference = TL.Parse <updates_Difference>(reader); }