public override void DeserializeBody(BinaryReader br) { id = br.ReadInt64(); access_hash = br.ReadInt64(); date = br.ReadInt32(); sizes = (TLVector<TLAbsPhotoSize>)ObjectUtils.DeserializeVector<TLAbsPhotoSize>(br); }
public override void DeserializeBody(BinaryReader br) { dialogs = (TLVector<TLDialog>)ObjectUtils.DeserializeVector<TLDialog>(br); messages = (TLVector<TLAbsMessage>)ObjectUtils.DeserializeVector<TLAbsMessage>(br); chats = (TLVector<TLAbsChat>)ObjectUtils.DeserializeVector<TLAbsChat>(br); users = (TLVector<TLAbsUser>)ObjectUtils.DeserializeVector<TLAbsUser>(br); }
public TLKey(int dcId, byte[] authKey) { this.dcId = dcId; this.authKey = authKey; this.isbAuthorised = false; this.salts = new TLVector<TLLastKnownSalt>(); this.oldSessions = new TLVector<TLOldSession>(); }
public override void DeserializeBody(BinaryReader br) { updates = (TLVector<TLAbsUpdate>)ObjectUtils.DeserializeVector<TLAbsUpdate>(br); users = (TLVector<TLAbsUser>)ObjectUtils.DeserializeVector<TLAbsUser>(br); chats = (TLVector<TLAbsChat>)ObjectUtils.DeserializeVector<TLAbsChat>(br); date = br.ReadInt32(); seq = br.ReadInt32(); }
public TLConfig(Int64 _date, Boolean _testMode, Int64 _thisDc, TLVector<TLDcOption> _dcOptions, Int64 _chatSizeMax, Int64 _broadcastSizeMax) { this.date = _date; this.testMode = _testMode; this.thisDc = _thisDc; this.dcOptions = _dcOptions; this.chatSizeMax = _chatSizeMax; this.broadcastSizeMax = _broadcastSizeMax; }
public TLStorage() { keys = new TLVector<TLKey>(); dcInfos = new TLVector<TLDcInfo>(); primaryDc = 1; isbAuthorized = false; uid = 0; phone = ""; }
public override void DeserializeBody(BinaryReader br) { flags = br.ReadInt32(); pts = br.ReadInt32(); count = br.ReadInt32(); messages = (TLVector<TLAbsMessage>)ObjectUtils.DeserializeVector<TLAbsMessage>(br); chats = (TLVector<TLAbsChat>)ObjectUtils.DeserializeVector<TLAbsChat>(br); users = (TLVector<TLAbsUser>)ObjectUtils.DeserializeVector<TLAbsUser>(br); }
public override void DeserializeBody(BinaryReader br) { new_messages = (TLVector<TLAbsMessage>)ObjectUtils.DeserializeVector<TLAbsMessage>(br); new_encrypted_messages = (TLVector<TLAbsEncryptedMessage>)ObjectUtils.DeserializeVector<TLAbsEncryptedMessage>(br); other_updates = (TLVector<TLAbsUpdate>)ObjectUtils.DeserializeVector<TLAbsUpdate>(br); chats = (TLVector<TLAbsChat>)ObjectUtils.DeserializeVector<TLAbsChat>(br); users = (TLVector<TLAbsUser>)ObjectUtils.DeserializeVector<TLAbsUser>(br); intermediate_state = (Updates.TLState)ObjectUtils.DeserializeObject(br); }
public override void DeserializeBody(BinaryReader br) { flags = br.ReadInt32(); file = (TLAbsInputFile)ObjectUtils.DeserializeObject(br); caption = StringUtil.Deserialize(br); if ((flags & 1) != 0) stickers = (TLVector<TLAbsInputDocument>)ObjectUtils.DeserializeVector<TLAbsInputDocument>(br); else stickers = null; }
public override void deserializeBody(BufferedStream stream, TLContext context) { try { keys = (TLVector<TLKey>)StreamingUtils.readTLVector(stream, context); dcInfos = (TLVector<TLDcInfo>)StreamingUtils.readTLVector(stream, context); primaryDc = StreamingUtils.readInt(stream); isbAuthorized = StreamingUtils.readTLBool(stream); uid = StreamingUtils.readInt(stream); phone = StreamingUtils.readTLString(stream); } catch(IOException e) { System.Diagnostics.Debug.WriteLine(e.StackTrace); } }
public override void deserializeBody(BufferedStream stream, TLContext context) { try { this.date = StreamingUtils.readInt(stream); this.testMode = StreamingUtils.readTLBool(stream); this.thisDc = StreamingUtils.readInt(stream); this.dcOptions = (TLVector<TLDcOption>)StreamingUtils.readTLVector(stream, context); this.chatSizeMax = StreamingUtils.readInt(stream); this.broadcastSizeMax = StreamingUtils.readInt(stream); } catch(IOException e) { System.Diagnostics.Debug.WriteLine(e.StackTrace); } }
public override void deserializeBody(BufferedStream stream, TLContext context) { try { dcId = StreamingUtils.readInt(stream); authKey = StreamingUtils.readBytes(256, stream); isbAuthorised = StreamingUtils.readTLBool(stream); salts = (TLVector<TLLastKnownSalt>)StreamingUtils.readTLVector(stream, context); oldSessions = (TLVector<TLOldSession>)StreamingUtils.readTLVector(stream, context); } catch (IOException e) { System.Diagnostics.Debug.WriteLine(e.StackTrace); } }
public void TLVectorHydration() { var pos = 0; var intvec = new TLVector<TLInt>(bufferInt, ref pos); Assert.AreEqual(testedInts.Length, intvec.Count); CollectionAssert.AreEquivalent(testedInts, intvec.Value.Select(i => i.Value).ToArray()); using (var stream = new MemoryStream(bufferInt)) { pos = 0; intvec = new TLVector<TLInt>(stream, ref pos); Assert.AreEqual(testedInts.Length, intvec.Count); CollectionAssert.AreEquivalent(testedInts, intvec.Value.Select(i => i.Value).ToArray()); } }
public void TLVectorSerialization() { var intvec = new TLVector<TLInt>(testedInts.Length); foreach(var i in testedInts) { intvec.Add(new TLInt(i)); } var buffer = intvec.ToBytes(); CollectionAssert.AreEqual(bufferInt, buffer); using (var stream = new MemoryStream()) { intvec.ToStream(stream); stream.Read(buffer, 0, 28); // Observed through debugging CollectionAssert.AreEqual(bufferInt, buffer); } }
public void Serialize_ThenByteListReturned() { // arrange TLVector<Int32> vector = new TLVector<Int32> { Content = { 0x34ABDC65 } }; byte[] expected = { 0x15, 0xC4, 0xB5, 0x1C, 0x01, 0x00, 0x00, 0x00, 0x65, 0xDC, 0xAB, 0x34 }; // act byte[] result = _testee.Serialize(vector, new TLPropertyAttribute(0) { VectorType = typeof(Int32) }); // act result.ShouldBeEquivalentTo(expected); }
public void Deserialize_ThenByteArrayDeserialized() { // arrange byte[] bytes = { 0x15, 0xC4, 0xB5, 0x1C, 0x01, 0x00, 0x00, 0x00, 0xFF, 0x7E, 0x3C, 0x88, 0x65, 0xDC, 0xAB, 0x34 }; TLVector<Int64> expected = new TLVector<Int64> { Content = { 0x34ABDC65883C7EFF } }; // act TLVector<Int64> result = (TLVector<Int64>)_testee.Deserialize(bytes.ToList(), new TLPropertyAttribute(0) { VectorType = typeof(Int64) }); // assert result.ShouldBeEquivalentTo(expected); }
public override void DeserializeBody(BinaryReader br) { title = StringUtil.Deserialize(br); users = (TLVector<int>)ObjectUtils.DeserializeVector<int>(br); }
public override void DeserializeBody(BinaryReader br) { sets = (TLVector<TLAbsStickerSetCovered>)ObjectUtils.DeserializeVector<TLAbsStickerSetCovered>(br); }
public override void DeserializeResponse(BinaryReader br) { Response = ObjectUtils.DeserializeVector <TLContactStatus>(br); }
public override void DeserializeBody(BinaryReader br) { Participant = (TLAbsChannelParticipant)ObjectUtils.DeserializeObject(br); Users = ObjectUtils.DeserializeVector <TLAbsUser>(br); }
public override void DeserializeBody(BinaryReader br) { count = br.ReadInt32(); sets = (TLVector <TLAbsStickerSetCovered>)ObjectUtils.DeserializeVector <TLAbsStickerSetCovered>(br); Type = TLAbsArchivedStickersTypes.TLArchivedStickers; }
public async Task <MTObject> Handle_dep(IMessageContext <TLGetDialogs> context) { await Task.CompletedTask; var chats = new TLVector <TLAbsChat>(); var chat = new NET.Schema.Layer72.TLChat { Title = "draft", Flags = 0, Id = 100, admin = true, Photo = new TLChatPhotoEmpty { } //Photo = new TLChatPhoto { // Flags = 0, // HasVideo = false, // PhotoBig = new TLFileLocationToBeDeprecated { }, // PhotoSmall = new TLFileLocationToBeDeprecated { } //} }; chats.Add(chat); var users = new TLVector <TLAbsUser>() { }; //users.Add(new TLUserEmpty { }); users.Add(new NET.Schema.Layer72.TLUser { Id = 1, FirstName = "Ahmad" }); users.Add(new NET.Schema.Layer72.TLUser { Id = 10, FirstName = "Babak" }); users.Add(new NET.Schema.Layer72.TLUser { Id = 11, FirstName = "Zary" }); var dialogs = new TLVector <TLAbsDialog>(); var dialog = new NET.Schema.Layer72.TLDialog { Peer = new TLPeerUser { UserId = 1 }, NotifySettings = new NET.Schema.Layer72.TLPeerNotifySettingsEmpty { } }; dialogs.Add(dialog); dialog = new NET.Schema.Layer72.TLDialog { Peer = new TLPeerUser { UserId = 10 }, NotifySettings = new NET.Schema.Layer72.TLPeerNotifySettingsEmpty { } }; dialogs.Add(dialog); dialog = new NET.Schema.Layer72.TLDialog { Peer = new TLPeerUser { UserId = 11 }, NotifySettings = new NET.Schema.Layer72.TLPeerNotifySettingsEmpty { } }; dialogs.Add(dialog); var result = new NET.Schema.TL.Messages.TLDialogs { Chats = chats, Dialogs = dialogs, Messages = new TLVector <TLAbsMessage>(), Users = users }; //var bytes = result.ToByteArray(); //List<uint> items = new List<uint>(); //for(var i=0; i < bytes.Length; i = i + 4) //{ // items.Add(BitConverter.ToUInt32(bytes, i)); //} //int[] bytesAsInts = Array.ConvertAll(bytes, c => (int)c); return(result); }
public async Task <TLAbsUpdates> SendUploadedDocument( TLAbsInputPeer peer, TLAbsInputFile file, string caption, string mimeType, TLVector <TLAbsDocumentAttribute> attributes) { return(await SendRequestAsync <TLAbsUpdates>(new TLRequestSendMedia() { RandomId = Helpers.GenerateRandomLong(), Background = false, ClearDraft = false, Media = new TLInputMediaUploadedDocument() { File = file, Caption = caption, MimeType = mimeType, Attributes = attributes }, Peer = peer })); }
public override void DeserializeResponse(BinaryReader br) { Response = (TLVector <TLSecureValue>)ObjectUtils.DeserializeVector <TLSecureValue>(br); }
public override void DeserializeBody(BinaryReader br) { Count = br.ReadInt32(); Participants = (TLVector <TLAbsChannelParticipant>)ObjectUtils.DeserializeVector <TLAbsChannelParticipant>(br); Users = (TLVector <TLAbsUser>)ObjectUtils.DeserializeVector <TLAbsUser>(br); }
public override void DeserializeBody(BinaryReader br) { Blocked = (TLVector <TLContactBlocked>)ObjectUtils.DeserializeVector <TLContactBlocked>(br); Users = (TLVector <TLAbsUser>)ObjectUtils.DeserializeVector <TLAbsUser>(br); }
public override void DeserializeBody(BinaryReader br) { hash = br.ReadInt32(); sets = (TLVector <TLAbsStickerSetCovered>)ObjectUtils.DeserializeVector <TLAbsStickerSetCovered>(br); unread = (TLVector <long>)ObjectUtils.DeserializeVector <long>(br); }
public override void DeserializeBody(BinaryReader br) { this.Hash = br.ReadInt32(); this.Sets = (TLVector <TLStickerSet>)ObjectUtils.DeserializeVector <TLStickerSet>(br); }
public override void DeserializeBody(BinaryReader br) { rules = (TLVector<TLAbsPrivacyRule>)ObjectUtils.DeserializeVector<TLAbsPrivacyRule>(br); users = (TLVector<TLAbsUser>)ObjectUtils.DeserializeVector<TLAbsUser>(br); }
public async Task <MTObject> Handle(IMessageContext <TLGetDialogs> context) { var result = await Task.FromResult <MTObject>(null); try { var dialogs = new TLVector <TLAbsDialog>(); var users = new TLVector <TLAbsUser>(); var chats = new TLVector <TLAbsChat>(); var messages = new TLVector <TLAbsMessage>(); var session = manager.GetSession(context.AuthKey()); if (session == null) { throw new Exception($"Session not found."); } var user = await session.GetUser(); var users_list = new List <int>(); users.Add(new NET.Schema.Layer72.TLUser { Id = session.GetUserId(), FirstName = string.IsNullOrWhiteSpace(user?.UserData?.FirstName)? $"User {user.Id}": user.UserData.FirstName, Self = true });; var dialog = new NET.Schema.Layer72.TLDialog { Peer = new TLPeerUser { UserId = session.GetUserId() }, NotifySettings = new NET.Schema.Layer72.TLPeerNotifySettingsEmpty { } }; dialogs.Add(dialog); var contacts = await contactService.GetContacts(session.GetUserId()); foreach (var privateChat in await this.messagingService.GetPrivateChats(session.GetUserId(), 0, 1000)) { if (!users_list.Contains(privateChat.UserId2)) { users_list.Add(privateChat.UserId2); } dialog = new NET.Schema.Layer72.TLDialog { Peer = new TLPeerUser { UserId = privateChat.UserId2 }, NotifySettings = new NET.Schema.Layer72.TLPeerNotifySettingsEmpty { } }; dialogs.Add(dialog); } foreach (var contact in await contactService.GetContacts(session.GetUserId())) { if (!users_list.Contains(contact.ImportedContactId)) { users_list.Add(contact.ImportedContactId); } } foreach (var chat_user in users_list) { var _user = await this.contactService.GetUser(chat_user); if (_user != null) { users.Add(new NET.Schema.Layer72.TLUser { Id = _user.Id, FirstName = _user.FirstName, LastName = _user.LastName, AccessHash = _user.Access_Hash, Phone = _user.Phone });; } } if (session.GetUserId() == 1 && 1 == 0) { dialog = new NET.Schema.Layer72.TLDialog { Peer = new TLPeerUser { UserId = 2 }, NotifySettings = new NET.Schema.Layer72.TLPeerNotifySettingsEmpty { } }; dialogs.Add(dialog); users.Add(new NET.Schema.Layer72.TLUser { Id = 2, FirstName = $"User {2}", });; } if (session.GetUserId() == 2 && 1 == 0) { dialog = new NET.Schema.Layer72.TLDialog { Peer = new TLPeerUser { UserId = 1 }, NotifySettings = new NET.Schema.Layer72.TLPeerNotifySettingsEmpty { } }; dialogs.Add(dialog); users.Add(new NET.Schema.Layer72.TLUser { Id = 1, FirstName = $"User {1}", });; } result = new NET.Schema.TL.Messages.TLDialogs { Chats = chats, Dialogs = dialogs, Messages = new TLVector <TLAbsMessage>(), Users = users }; } catch (Exception err) { this.logger.LogError( $"An error occured while trying to handle GetDialogs.:\r\n{err.GetBaseException().Message}"); throw; } return(result); }
public TLReplayInlineKeyboardMarkup() { this.rows = new TLVector(); }
public override void DeserializeBody(BinaryReader br) { Chats = (TLVector <TLAbsChat>)ObjectUtils.DeserializeVector <TLAbsChat>(br); }
public override void DeserializeResponse(BinaryReader br) { Response = (TLVector <long>)ObjectUtils.DeserializeVector <long>(br); }
public void Done() { if (SelectedMainRule == null) { return; } var rules = new TLVector <TLInputPrivacyRuleBase>(); if (_selectedDisallowUsers != null && _selectedDisallowUsers.Users != null && _selectedDisallowUsers.Users.Count > 0) { var inputDisallowUsers = (TLInputPrivacyValueDisallowUsers)_selectedDisallowUsers.ToInputRule(); foreach (var userId in _selectedDisallowUsers.Users) { var user = CacheService.GetUser(userId); if (user != null) { inputDisallowUsers.Users.Add(user.ToInputUser()); } } rules.Add(inputDisallowUsers); } if (_selectedAllowUsers != null && _selectedAllowUsers.Users != null && _selectedAllowUsers.Users.Count > 0) { var inputAllowUsers = (TLInputPrivacyValueAllowUsers)_selectedAllowUsers.ToInputRule(); foreach (var userId in _selectedAllowUsers.Users) { var user = CacheService.GetUser(userId); if (user != null) { inputAllowUsers.Users.Add(user.ToInputUser()); } } rules.Add(inputAllowUsers); } var inputMainRule = SelectedMainRule.ToInputRule(); rules.Add(inputMainRule); IsWorking = true; MTProtoService.SetPrivacyAsync(new TLInputPrivacyKeyChatInvite(), rules, result => { IsWorking = false; //EventAggregator.Publish(new TLUpdatePrivacy{Key = new TLPrivacyKeyStatusTimestamp(), Rules = result.Rules}); BeginOnUIThread(() => NavigationService.GoBack()); }, error => { IsWorking = false; if (error.CodeEquals(ErrorCode.FLOOD)) { MessageBox.Show(AppResources.FloodWaitString + Environment.NewLine + "(" + error.Message + ")", AppResources.Error, MessageBoxButton.OK); } Execute.ShowDebugMessage("account.setPrivacy error " + error); }); }
public TLKeyboardButtonRow() { this.buttons = new TLVector(); }
public override void DeserializeBody(BinaryReader br) { Hash = br.ReadInt32(); Themes = (TLVector <TLTheme>)ObjectUtils.DeserializeVector <TLTheme>(br); }
public override void DeserializeBody(BinaryReader br) { this.Authorizations = (TLVector <TLAuthorization>)ObjectUtils.DeserializeVector <TLAuthorization>(br); }
public virtual void setEntities(TLVector entities) { this.entities = entities; }
public override void deserializeResponse(BinaryReader br) { Response = (TLVector<TLAbsWallPaper>)ObjectUtils.DeserializeVector<TLAbsWallPaper>(br); }
public override void DeserializeResponse(BinaryReader br) { Response = (TLVector <TLLangPackLanguage>)ObjectUtils.DeserializeVector <TLLangPackLanguage>(br); }
public override void deserializeBody(InputStream stream, TLContext context) { this.rows = StreamingUtils.readTLVector(stream, context); }
public override void deserializeResponse(BinaryReader br) { Response = (TLVector<int>)ObjectUtils.DeserializeVector<int>(br); }
public override void DeserializeResponse(BinaryReader br) { Response = (TLVector <TLAbsWallPaper>)ObjectUtils.DeserializeVector <TLAbsWallPaper>(br); }
public override void DeserializeBody(BinaryReader br) { messages = (TLVector <TLAbsMessage>)ObjectUtils.DeserializeVector <TLAbsMessage>(br); chats = (TLVector <TLAbsChat>)ObjectUtils.DeserializeVector <TLAbsChat>(br); users = (TLVector <TLAbsUser>)ObjectUtils.DeserializeVector <TLAbsUser>(br); }
public override void DeserializeBody(BinaryReader br) { flags = br.ReadInt32(); exclude_new_messages = (flags & 2) != 0; ranges = (TLVector<TLMessageRange>)ObjectUtils.DeserializeVector<TLMessageRange>(br); }
public override void DeserializeBody(BinaryReader br) { Rules = (TLVector <TLAbsPrivacyRule>)ObjectUtils.DeserializeVector <TLAbsPrivacyRule>(br); Users = (TLVector <TLAbsUser>)ObjectUtils.DeserializeVector <TLAbsUser>(br); }
public override void deserializeResponse(BinaryReader br) { Response = (TLVector<TLContactStatus>)ObjectUtils.DeserializeVector<TLContactStatus>(br); }
public override void DeserializeBody(BinaryReader br) { Photo = (TLAbsPhoto)ObjectUtils.DeserializeObject(br); Users = (TLVector <TLAbsUser>)ObjectUtils.DeserializeVector <TLAbsUser>(br); }
public override void DeserializeBody(BinaryReader br) { full_chat = (TLAbsChatFull)ObjectUtils.DeserializeObject(br); chats = (TLVector<TLAbsChat>)ObjectUtils.DeserializeVector<TLAbsChat>(br); users = (TLVector<TLAbsUser>)ObjectUtils.DeserializeVector<TLAbsUser>(br); }
public override void DeserializeBody(BinaryReader br) { users = (TLVector<int>)ObjectUtils.DeserializeVector<int>(br); }
public override void DeserializeBody(BinaryReader br) { key = (TLAbsPrivacyKey)ObjectUtils.DeserializeObject(br); rules = (TLVector<TLAbsPrivacyRule>)ObjectUtils.DeserializeVector<TLAbsPrivacyRule>(br); }
public override void DeserializeBody(BinaryReader br) { flags = br.ReadInt32(); final = (flags & 1) != 0; pts = br.ReadInt32(); if ((flags & 2) != 0) timeout = br.ReadInt32(); else timeout = null; new_messages = (TLVector<TLAbsMessage>)ObjectUtils.DeserializeVector<TLAbsMessage>(br); other_updates = (TLVector<TLAbsUpdate>)ObjectUtils.DeserializeVector<TLAbsUpdate>(br); chats = (TLVector<TLAbsChat>)ObjectUtils.DeserializeVector<TLAbsChat>(br); users = (TLVector<TLAbsUser>)ObjectUtils.DeserializeVector<TLAbsUser>(br); }
public override void DeserializeBody(BinaryReader br) { hash = StringUtil.Deserialize(br); stickers = (TLVector<TLAbsDocument>)ObjectUtils.DeserializeVector<TLAbsDocument>(br); }
public override void DeserializeBody(BinaryReader br) { Hash = StringUtil.Deserialize(br); Stickers = ObjectUtils.DeserializeVector <TLAbsDocument>(br); }
public override void DeserializeBody(BinaryReader br) { count = br.ReadInt32(); chats = (TLVector <TLAbsChat>)ObjectUtils.DeserializeVector <TLAbsChat>(br); }
public void ReportSpamAsync(TLInputChannelBase channel, TLInputUserBase userId, TLVector <int> id, Action <bool> callback, Action <TLRPCError> faultCallback = null) { var obj = new TLChannelsReportSpam { Channel = channel, UserId = userId, Id = id }; const string caption = "channels.reportSpam"; SendInformativeMessage <bool>(caption, obj, callback, faultCallback); }
public override void DeserializeBody(BinaryReader br) { blocked = (TLVector<TLContactBlocked>)ObjectUtils.DeserializeVector<TLContactBlocked>(br); users = (TLVector<TLAbsUser>)ObjectUtils.DeserializeVector<TLAbsUser>(br); }
public override void DeserializeBody(BinaryReader br) { hash = br.ReadInt32(); stickers = (TLVector <TLAbsDocument>)ObjectUtils.DeserializeVector <TLAbsDocument>(br); Type = TLAbsRecentStickersTypes.TLRecentStickers; }
public override void DeserializeBody(BinaryReader br) { channel = (TLAbsInputChannel)ObjectUtils.DeserializeObject(br); users = (TLVector<TLAbsInputUser>)ObjectUtils.DeserializeVector<TLAbsInputUser>(br); }
public override void DeserializeBody(BinaryReader br) { peer = (TLAbsPeer)ObjectUtils.DeserializeObject(br); chats = (TLVector <TLAbsChat>)ObjectUtils.DeserializeVector <TLAbsChat>(br); users = (TLVector <TLAbsUser>)ObjectUtils.DeserializeVector <TLAbsUser>(br); }